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; }