From eb7e2783ecc4a64482df99114037842635c95cef Mon Sep 17 00:00:00 2001 From: monoid Date: Sun, 10 Jan 2021 16:54:49 +0900 Subject: [PATCH] add server do not response map file if production --- src/server.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server.ts b/src/server.ts index 542f52c..0ba387f 100644 --- a/src/server.ts +++ b/src/server.ts @@ -58,7 +58,8 @@ export async function create_server(){ })} static_file_server('dist/css/style.css','css'); static_file_server('dist/js/bundle.js','js'); - static_file_server('dist/js/bundle.js.map','text'); + if(setting.mode === "development") + static_file_server('dist/js/bundle.js.map','text'); const content_router = getContentRouter(createKnexContentsAccessor(db)); router.use('/content',content_router.routes()); @@ -67,6 +68,7 @@ export async function create_server(){ router.post('/user/login',createLoginMiddleware(db)); router.post('/user/logout',LogoutMiddleware); + if(setting.mode == "development"){ let mm_count = 0; app.use(async (ctx,next)=>{ console.log(`==========================${mm_count++}`); @@ -74,7 +76,7 @@ export async function create_server(){ console.log(`${fromClient} : ${ctx.method} ${ctx.url}`); await next(); //console.log(`404`); - }); + });} app.use(router.routes()); app.use(router.allowedMethods()); return app;