JavaScript (ESM) base website script using a plugin as a router that is lightweight and easy to customize.
- Plugin as Router
- Auto List Feature
- High Optimation
- Easy to Customize
- Show User IP
- Restrict Access (IP Whitelist)
- Request Per Minute Limit
- Suitable for Rest API
- etc.
This is an example of a router
import { Loader } from '../lib/index.js'
const Scraper = Loader.scrapers
export const routes = {
category: 'main',
path: '/api/tempo',
parameter: ['q'],
method: 'get',
execution: async (req, res, next) => {
const { q } = req.query
const json = await Scraper.tempo.search(q)
res.json(json)
},
error: false,
authorize: false,
rpm: false,
protect: true,
premium: false,
restrict: false
}
There are two types of middleware: global middleware, which is applied based on route attributes, and 'only' middleware, which is applied directly in the router or plugin.
export const routes = {
error: Boolean,
authorize: Boolean,
rpm: Boolean,
protect: Boolean,
premium: Boolean,
restrict: Boolean
}
import some from './middlewares/only/some.js'
export const routes = {
middleware: [some]
}
$ yarn
$ node .
or want to use pm2
$ yarn
$ npm i -g pm2
$ pm2 start pm2.cjs && pm2 logs
/api/tempo?q={query}
Open-API is part of Neoxr API