2019-10-28 08:21:03 +08:00
|
|
|
const Koa = require("koa");
|
2019-10-31 15:31:11 +08:00
|
|
|
const requter = require("./bin/router.js");
|
2019-11-12 23:30:26 +08:00
|
|
|
jwt = require('jsonwebtoken');
|
|
|
|
dbs = require("./bin/mongodb.js")('mongodb://localhost:27017/',"myblog")
|
2019-10-28 08:21:03 +08:00
|
|
|
// console.log(requter)
|
|
|
|
// import requter from "./bin/router"
|
|
|
|
const app = new Koa();
|
|
|
|
app.use(async (ctx,next)=>{
|
|
|
|
// await next();
|
2019-11-12 16:50:28 +08:00
|
|
|
console.log(ctx.url)
|
|
|
|
// ctx.response.body = {a:1};
|
2019-11-12 23:30:26 +08:00
|
|
|
await next()
|
2019-10-28 08:21:03 +08:00
|
|
|
console.log("执行")
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const bodyParser = require('koa-bodyparser');
|
|
|
|
app.use(bodyParser());
|
|
|
|
// console.log(requter())
|
|
|
|
app.use(requter());
|
2019-11-12 17:06:53 +08:00
|
|
|
app.listen(3000);
|
|
|
|
console.log("http://localhost:3000")
|