更新 'app.js'

This commit is contained in:
luyuan 2021-03-15 16:00:55 +08:00
parent 81585f81f7
commit 5fa9fd13f2

5
app.js
View File

@ -4,6 +4,8 @@ dbs = require("./bin/mongodb.js")('mongodb://localhost:27017/',"ceshikaoshi")
// console.log(requter) // console.log(requter)
// import requter from "./bin/router" // import requter from "./bin/router"
const app = new Koa(); const app = new Koa();
const bodyParser = require('koa-bodyparser');
app.use(bodyParser());
app.use(async (ctx, next) => { app.use(async (ctx, next) => {
// 允许来自所有域名请求 // 允许来自所有域名请求
ctx.set("Access-Control-Allow-Origin", "*"); ctx.set("Access-Control-Allow-Origin", "*");
@ -60,8 +62,7 @@ app.use(async (ctx,next)=>{
}); });
const bodyParser = require('koa-bodyparser');
app.use(bodyParser());
// console.log(requter()) // console.log(requter())
app.use(requter()); app.use(requter());
app.listen(3002); app.listen(3002);