From 839be6477d4b5870a03c82791af5a156882eadcb Mon Sep 17 00:00:00 2001 From: mei23 Date: Fri, 24 Aug 2018 05:26:26 +0900 Subject: [PATCH] Return 404 for unknown API --- src/server/api/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server/api/index.ts b/src/server/api/index.ts index 3ec7a28df..a8f6455d9 100644 --- a/src/server/api/index.ts +++ b/src/server/api/index.ts @@ -46,6 +46,11 @@ router.post('/signin', require('./private/signin').default); router.use(require('./service/github').routes()); router.use(require('./service/twitter').routes()); +// Return 404 for unknown API +router.all('*', async ctx => { + ctx.status = 404; +}); + // Register router app.use(router.routes());