change abstract path

This commit is contained in:
monoid 2021-01-05 20:22:17 +09:00
parent 1a8b3d5d15
commit d88c65c26c
2 changed files with 9 additions and 9 deletions

View File

@ -4,11 +4,11 @@
<meta charset="UTF-8">
<title>react-sample</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./dist/css/style.css">
<link rel="stylesheet" href="/dist/css/style.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
</head>
<body>
<div id="root"></div>
<script src="dist/js/bundle.js"></script>
<script src="/dist/js/bundle.js"></script>
</body>
</html>

View File

@ -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'
router.get('/doc/:rest(.*)'
,async (ctx,next)=>{
ctx.body = ctx.query;
console.log(JSON.stringify(ctx.query));
await 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;
}