fix: 引入用户相关接口

This commit is contained in:
luozhj33 2026-03-19 14:06:55 +08:00
parent 2647de4455
commit 3b28fbcdc4

View File

@ -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
}); });