# easy-curd **Repository Path**: MrMoons/easy-curd ## Basic Information - **Project Name**: easy-curd - **Description**: 前端增删改查练习接口服务 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-09-25 - **Last Updated**: 2023-10-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # egg-server ## QuickStart see [egg docs][egg] for more detail. ### Development ```bash $ npm i $ npm run dev $ open http://localhost:7001/ ``` ### Deploy ```bash $ npm start $ npm stop ``` ### npm scripts - Use `npm run lint` to check code style. - Use `npm test` to run unit test. - Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail. # Api Refrence ## 增删改查接口 给前端开发者提供基础数据增删改查服务,使用者可自定义数据schema(模块名称)。 开发者在前端请求时可随意定义schema名称和schema对象字段。 > 以下示例使用user为模块名称 #### 查询列表(不分页) ```bash [GET] /api/user?username=xxx&age=23 --result: { code: 0, msg: 'success', data: User[] } ``` #### 查询列表(分页) ```bash # 查询参数需要携带 pageNum和pageSize [GET] /api/user?pageNum=1&pageSize=10&username=xxx&age=23 --result: { code: 0, msg: 'success', data: { data: User[], pageNum: 1, pageSize: 20, total: 999 } } ``` #### 查询详情 ```bash # 查询参数需要携带 pageNum和pageSize [GET] /api/user/${id} --result: { code: 0, msg: 'success', data: User } ``` #### 新增 ```bash [POST] /api/user --header 'Content-Type: application/json' --data-raw '{"field1": "value1", "field2": "value2", ...}' --result: { code: 0, msg: 'success', data: User } ``` #### 修改 ```bash [PUT] /api/user --header 'Content-Type: application/json' --data-raw '{"id": "uuid", "field1": "value1", "field2": "value2", ...}' --result: { code: 0, msg: 'success', data: true } ``` #### 删除 ```bash [DELETE] /api/user/${id} --result: { code: 0, msg: 'success', data: true } ``` ## 工具接口 #### 模拟接口延迟 ```bash [GET] /delay?delay=1000 --result: { code: 0, msg: 'success', data: 'delay 1000mm success!' } ```