fix: 修复/robots.txt路由 (#4874)

This commit is contained in:
CaoMeiYouRen
2020-05-29 14:55:08 +08:00
committed by GitHub
parent b065ad91f5
commit 02a26e6938

View File

@@ -22,14 +22,13 @@ for (const project in RouterPath) {
// index
router.get('/', require('./routes/index'));
router.get('/robots.txt', async (ctx, next) => {
router.get('/robots.txt', async (ctx) => {
if (config.disallowRobot) {
ctx.set('Content-Type', 'text/plain');
ctx.body = 'User-agent: *\nDisallow: /';
} else {
ctx.throw(404, 'Not Found');
}
await next();
});
// test