parent
74ab09815f
commit
815cdd3052
@ -0,0 +1,17 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const app = express();
|
||||||
|
const router = require('./router');
|
||||||
|
const bodyParser = require('body-parser');
|
||||||
|
|
||||||
|
// 中间件
|
||||||
|
app.use(bodyParser.json());
|
||||||
|
app.use(bodyParser.urlencoded({ extended: true }));
|
||||||
|
|
||||||
|
// 使用路由
|
||||||
|
app.use('/', router);
|
||||||
|
|
||||||
|
// 监听端口
|
||||||
|
const PORT = process.env.PORT || 3000;
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`Server running on port ${PORT}`);
|
||||||
|
});
|
Loading…
Reference in new issue