mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-02 01:58:11 +08:00
feat(core): first attempt to init script standard (#8224)
- lazy load - rate limit per path - init .debug.json support - docs - maintainer - radar
This commit is contained in:
17
lib/core_router.js
Normal file
17
lib/core_router.js
Normal file
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user