blog-server/app.js

18 lines
411 B
JavaScript
Raw Normal View History

2019-10-28 08:21:03 +08:00
const Koa = require("koa");
const requter = require("./router.js");
// console.log(requter)
// import requter from "./bin/router"
const app = new Koa();
app.use(async (ctx,next)=>{
// await next();
ctx.response.body = {a:1};
// next()
console.log("执行")
});
const bodyParser = require('koa-bodyparser');
app.use(bodyParser());
// console.log(requter())
app.use(requter());
app.listen(3000);