core/app.js

29 lines
817 B
JavaScript
Raw Normal View History

2019-12-26 17:37:51 +08:00
const Koa = require("koa");
const requter = require("./bin/router.js");
dbs = require("./bin/mongodb.js")('mongodb://localhost:27017/Cartoon-And-Fiction',"Cartoon-And-Fiction")
// console.log(requter)
// import requter from "./bin/router"
2020-01-02 10:24:33 +08:00
let reptile = require("./bin/reptile/binimport")
reptilelist = [];
reptile().then((res)=>{
// console.log(res)
reptilelist = res;
})
2019-12-26 17:37:51 +08:00
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);
2019-12-11 09:38:55 +08:00
console.log("http://localhost:3002")