From 3b28fbcdc439d44c40fb7e4a72d94ade992d5ee0 Mon Sep 17 00:00:00 2001 From: luozhj33 Date: Thu, 19 Mar 2026 14:06:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=95=E5=85=A5=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/src/app.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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