Files
RSSHub/lib/core_router.js
NeverBehave 0792f7ba25 feat(core): first attempt to init script standard (#8224)
- lazy load
- rate limit per path
- init .debug.json support
- docs
- maintainer
- radar
2021-09-22 05:41:00 -07:00

18 lines
426 B
JavaScript

const Router = require('@koa/router');
const config = require('@/config').value;
const router = new Router();
// Load Core Route
router.get('/', require('./routes/index'));
router.get('/robots.txt', (ctx) => {
if (config.disallowRobot) {
ctx.set('Content-Type', 'text/plain');
ctx.body = 'User-agent: *\nDisallow: /';
} else {
ctx.throw(404, 'Not Found');
}
});
module.exports = router;