22 lines
593 B
JavaScript
22 lines
593 B
JavaScript
const Koa = require("koa");
|
|
const requter = require("./bin/router.js");
|
|
jwt = require('jsonwebtoken');
|
|
dbs = require("./bin/mongodb.js")('mongodb://localhost:27017/myblog',"myblog")
|
|
// console.log(requter)
|
|
// import requter from "./bin/router"
|
|
const app = new Koa();
|
|
app.use(async (ctx,next)=>{
|
|
// await next();
|
|
console.log(ctx.url)
|
|
// ctx.response.body = {a:1};
|
|
await next()
|
|
console.log("执行")
|
|
});
|
|
|
|
|
|
const bodyParser = require('koa-bodyparser');
|
|
app.use(bodyParser());
|
|
// console.log(requter())
|
|
app.use(requter());
|
|
app.listen(3000);
|
|
console.log("http://localhost:3000") |