fix: 引入用户相关接口
This commit is contained in:
parent
2647de4455
commit
3b28fbcdc4
@ -2,12 +2,14 @@ const express = require('express');
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
|
||||
// 定义一个路由:当访问首页时
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello World!');
|
||||
});
|
||||
// 中间件
|
||||
app.use(express.json());
|
||||
|
||||
// 用户路由
|
||||
const userRoutes = require('./routes/user');
|
||||
app.use('/api', userRoutes);
|
||||
|
||||
// 启动服务器
|
||||
app.listen(port, () => {
|
||||
console.log(`服务器正在运行:http://localhost:${port}`);
|
||||
console.log(`服务器正在运行:http://localhost:${port}`); // TODO
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user