fix: add robots.txt
This commit is contained in:
parent
2cc359bd42
commit
e6b6f547bb
|
@ -3,15 +3,17 @@ import { genErrorResponse, ResError } from './response';
|
|||
import { withCORS } from './middlewares';
|
||||
import * as index from './routes/index';
|
||||
import * as favicon from './routes/favicon';
|
||||
import * as robots from './routes/robots';
|
||||
import * as image from './routes/image';
|
||||
import * as api from './routes/api';
|
||||
|
||||
const router = Router();
|
||||
router.options('*', withCORS);
|
||||
|
||||
// routes
|
||||
router.get('/', index.get);
|
||||
router.get('/favicon.ico', favicon.get);
|
||||
router.get('/robots.txt', robots.get);
|
||||
|
||||
// routes
|
||||
router.get('/:id', image.get);
|
||||
router.get('/api/:id', api.get);
|
||||
// router.delete('/api/:id', api.del);
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { genResponse } from '../response';
|
||||
|
||||
/**
|
||||
* @param {Request} req
|
||||
*/
|
||||
export async function get(req) {
|
||||
const robots = 'User-agent: *\nDisallow: /';
|
||||
return await genResponse(req, robots, {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': 'text/plain; charset=utf-8',
|
||||
'Cache-Control': 'public, max-age=86400',
|
||||
},
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue