diff --git a/back/src/app.js b/back/src/app.js index f9184f8..f5655cf 100644 --- a/back/src/app.js +++ b/back/src/app.js @@ -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 }); \ No newline at end of file