You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
396 B
18 lines
396 B
2 weeks ago
|
const express = require("express");
|
||
|
const app = express();
|
||
|
const router = require("./router");
|
||
|
const bodyParser = require("body-parser");
|
||
|
const cors = require("cors");
|
||
|
|
||
|
// 解决跨域
|
||
|
app.use(cors());
|
||
|
app.use(bodyParser.urlencoded({
|
||
|
extended: true
|
||
|
}));
|
||
|
app.use(express.static('public'));
|
||
|
app.use("/api",router);
|
||
|
|
||
|
|
||
|
app.listen(3001,() =>{
|
||
|
console.log("服务器运行在3001端口上");
|
||
|
})
|