From b895f8f24713fc376e16f73154522667157a66b2 Mon Sep 17 00:00:00 2001 From: aixianling Date: Tue, 25 Feb 2025 17:40:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor(app):=20=E9=87=8D=E6=9E=84=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=B9=B6=E6=B7=BB=E5=8A=A0=E5=BC=80=E5=8F=91=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了登录路由 - 添加了 nodemon 开发脚本 - 引入了 nodemon 依赖 - 在 verifyThirdPartyToken 中添加了日志输出 --- app.js | 7 ------- package.json | 8 +++++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app.js b/app.js index aa15250..0d5a4f5 100644 --- a/app.js +++ b/app.js @@ -33,13 +33,6 @@ router.get("/public", (ctx) => { ctx.body = "Public content"; }); -// 登录路由 -router.post("/login", (ctx) => { - const user = { id: 1, username: "admin" }; - const token = jwt.sign(user, process.env.JWT_SECRET, { expiresIn: "1h" }); - ctx.body = { token }; -}); - // 自定义中间件:解析并验证第三方Token app.use(async (ctx, next) => { const authHeader = ctx.headers.authorization; diff --git a/package.json b/package.json index 0447643..dca6e3f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "", "main": "app.js", "scripts": { - "start": "node app.js" + "start": "node app.js", + "dev": "nodemon app.js" }, "author": "kubbo", "license": "ISC", @@ -14,6 +15,7 @@ "koa": "^2.15.4", "koa-bodyparser": "^4.4.1", "koa-jwt": "^4.0.4", - "koa-router": "^13.0.1" + "koa-router": "^13.0.1", + "nodemon": "^3.0.2" } -} +} \ No newline at end of file