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
424 B
18 lines
424 B
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}`);
|
|
});
|