# guard-serve **Repository Path**: eobeans/guard-serve ## Basic Information - **Project Name**: guard-serve - **Description**: guard项目服务端 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2023-11-29 - **Last Updated**: 2023-11-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # guard-serve #### 介绍 guard项目服务端基础模板(非项目服务端) 该分支为guard服务端的基础模板,我们可以根据该模板快速搭建node服务器 #### 软件架构 NodeJs服务端模板 #### 使用说明 1. 下载本分支代码 2. npm install下载依赖 3. 全局安装typeScript 4. npm run dev 启动 #### 项目结构 ``` ---------- config 配置文件 ---------- db 数据库连接池 ---------- middleware 中间件 | ------ tokenVerification.ts token拦截请求中间件 ---------- plugins 插件 | ------ decorators.ts 封装了常用装饰器 | ------ getJson.ts 接口返回值标准格式生成函数 | ------ interface.ts 定义一些数据类型 | ------ Query.ts 封装了mysql查询函数 | ------ import.ts 集中返回全部常用函数、装饰器 ---------- routes 建议接口都写在这里 | ------ index.ts 接口类入口函数 ---------- index.ts 服务器入口函数 ``` #### 上手 ``` // 定义账号登录接口 // 1. 在src/routes/modules 目录下创建文件 User.ts (源码请查看对应目录) // 2. 在src/routes/index.ts中实例化User (源码请查看对应目录) // 3. 测试接口:请打开 requestTest/post.http 进行测试 // 连接websocket请参考src/routes/modules/User.ts中的案例 ``` #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request