更新 'app.js'
This commit is contained in:
parent
81585f81f7
commit
5fa9fd13f2
5
app.js
5
app.js
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user