From 655b03ea939b30b0b03d28501e8d0af985e66fcf Mon Sep 17 00:00:00 2001 From: Lmx <1960868911@qq.com> Date: Thu, 12 Feb 2026 09:13:38 +0800 Subject: [PATCH] =?UTF-8?q?docs(explain):=20=E6=9B=B4=E6=96=B0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9.gitignore=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新explain.txt文件,添加了更详细的项目结构说明,包括核心文件、 文件夹介绍和技术栈说明。同时修改.gitignore文件,将images/改为 uploads/images/以更好地反映实际使用的图片上传目录。 ``` --- .gitignore | 5 ++++- explain.txt | 40 +++++++++++++++++++++++++++++----------- uploads/images/.gitkeep | 1 - 3 files changed, 33 insertions(+), 13 deletions(-) delete mode 100644 uploads/images/.gitkeep diff --git a/.gitignore b/.gitignore index 4f990f4..007e3d9 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,7 @@ build/ # 测试覆盖率 coverage/ -.nyc_output/ \ No newline at end of file +.nyc_output/ + +# 上传的图片文件夹 +uploads/images/ \ No newline at end of file diff --git a/explain.txt b/explain.txt index f607b03..6387ce1 100644 --- a/explain.txt +++ b/explain.txt @@ -1,12 +1,30 @@ -config(存放数据库配置) -controllers(存放接口业务逻辑) -models(存放数据库模型) -routes(存放接口路由) -middlewares(存放中间件,暂用不上,先创建) +### 核心文件和文件夹 +- server.js :服务器启动文件,运行后启动后端服务 +- app.js :应用主配置文件,设置中间件、路由等 +- config/ :配置文件夹 + - db.js :数据库连接配置 +- controllers/ :控制器文件夹 + - userController.js :用户相关功能(如登录) + - productController.js :产品相关功能 +- models/ :数据模型文件夹 + - User.js :用户数据模型 + - Product.js :产品数据模型 +- routes/ :路由文件夹 + - userRoutes.js :用户相关接口路由 + - productRoutes.js :产品相关接口路由 +- utils/ :工具函数文件夹 + - jwt.js :JWT令牌生成工具 +- .env.example :环境变量示例文件 +- package.json :项目依赖配置文件 -.env(存放敏感配置,如数据库密码,不提交到 Git) -.env.example(环境变量示例,给团队参考,可提交 Git) -app.js(应用入口,配置中间件和路由) -server.js(服务启动文件,监听端口) - -db.js 配置数据库连接(config/db.js) \ No newline at end of file +## 技术栈 +### 核心技术 +- Node.js :JavaScript 运行环境,用于运行后端代码 +- Express :Web 框架,用于构建 API 接口 +- MySQL :关系型数据库,存储用户和产品数据 +- Sequelize :ORM 库,简化数据库操作 +### 辅助工具 +- JWT :用于生成和验证身份令牌 +- CORS :处理跨域请求,允许前端访问后端接口 +- dotenv :管理环境变量,如数据库连接信息 +- nodemon :开发时自动重启服务器,提高开发效率 \ No newline at end of file diff --git a/uploads/images/.gitkeep b/uploads/images/.gitkeep deleted file mode 100644 index 16cd381..0000000 --- a/uploads/images/.gitkeep +++ /dev/null @@ -1 +0,0 @@ -# This file keeps the images folder in git \ No newline at end of file