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:
NeverBehave
2021-09-22 05:41:00 -07:00
committed by GitHub
parent d77a039f05
commit 0792f7ba25
51 changed files with 737 additions and 331 deletions

17
lib/core_router.js Normal file
View 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;