wecat-serve-demo/app.js
2019-12-10 14:32:04 +08:00

23 lines
625 B
JavaScript

const Koa = require("koa");
const requter = require("./bin/router.js");
dbs = require("./bin/mongodb.js")('mongodb://localhost:27017/myblog',"wecatdemo")
// console.log(requter)
// import requter from "./bin/router"
const app = new Koa();
app.use(async (ctx,next)=>{
// await next();
console.log(ctx.url)
// console.time("asd")
// ctx.response.body = {a:1};
await next()
// console.log("执行")
// console.timeEnd("asd")
});
const bodyParser = require('koa-bodyparser');
app.use(bodyParser());
// console.log(requter())
app.use(requter());
app.listen(3002);
console.log("http://localhost:3002")