From d88c65c26cc704fe119c951c639d94dfc724507f Mon Sep 17 00:00:00 2001 From: monoid Date: Tue, 5 Jan 2021 20:22:17 +0900 Subject: [PATCH] change abstract path --- index.html | 4 ++-- src/server.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index de8dc9d..480ed51 100644 --- a/index.html +++ b/index.html @@ -4,11 +4,11 @@ react-sample - +
- + \ No newline at end of file diff --git a/src/server.ts b/src/server.ts index ec6b48a..dad7132 100644 --- a/src/server.ts +++ b/src/server.ts @@ -16,6 +16,7 @@ async function main(){ let app = new Koa(); app.use(bodyparser()); app.use(error_handler); + const index_html = readFileSync("index.html"); let router = new Router(); let settings = get_setting(); @@ -26,7 +27,7 @@ async function main(){ console.log(settings); router.get('/', async (ctx,next)=>{ ctx.type = "html"; - ctx.body = readFileSync("index.html"); + ctx.body = index_html; }); router.get('/dist/css/style.css',async (ctx,next)=>{ ctx.type = "css"; @@ -37,11 +38,10 @@ async function main(){ //ctx.set("",""); ctx.body = createReadStream("dist/js/bundle.js"); }); - router.get('/get' - ,async (ctx,next)=>{ - ctx.body = ctx.query; - console.log(JSON.stringify(ctx.query)); - await next(); + router.get('/doc/:rest(.*)' + ,async (ctx,next)=>{ + ctx.type = "html"; + ctx.body = index_html; } ); let content_router = getContentRouter(createKnexContentsAccessor(db)); @@ -58,7 +58,7 @@ async function main(){ app.use(router.routes()); app.use(router.allowedMethods()); - console.log("log"); + console.log("start server"); app.listen(3002); return app; }