core/app.js

29 lines
817 B
JavaScript

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"
let reptile = require("./bin/reptile/binimport")
reptilelist = [];
reptile().then((res)=>{
// console.log(res)
reptilelist = res;
})
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(3004);
console.log("http://localhost:3004")