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