说明文档
基本功能介绍
该包主要搭建简单的服务器
- GET POST DELETE PUT 请求
使用步骤
const exServer = exServer// 参数1 端口// 参数2 传入储存数据的json文件 默认同级目录下建立的db.json// 参数3 是否跨域 默认falseexServer// getData // 参数1 路径 默认 /data// 参数2 是否精确查找 根据参数 路径 /data/:idexServer// delData// 参数1 路径/:id 默认 /deldata/:idexServer// post // 参数1 路径 默认 /adddata// 参数2 请求所需参数[]:string 必须// 参数3 请求所需参数[]:string 可选 exServer// put // 参数1 路径/:id 默认 /deldata/:id
API说明
- exServer.exServer(3000, jsonFile, true).get("/get")
- 参数一:路径 默认 /data
- 参数二:是否精确查找 根据参数 路径 /data/:id
- exServer.exServer(3000, jsonFile, true).delete("/del")
- 参数一:路径/:id 默认 /deldata/:id
- exServer.exServer(3000, jsonFile, true).post("/add")
- 参数一:路径 默认 /adddata
- 参数二:请求所需参数[]:string 必须
- 参数二:请求所需参数[]:string 可选
- exServer.exServer(3000, jsonFile, true).put("/put")
- 参数一:路径/:id 默认 /deldata/:id