为什么发送多个POST请求失败[JSON-server]

时间:2019-12-04 13:31:50

标签: reactjs rest npm json-server

我通过RESTful约定使用JSON服务器多次发送POST请求。但这破坏了我的JSON服务器。有人知道这是什么原因吗?

代码的小部分:

axios.post(`http://localhost:3005/intersections/`, {
                    title: intersection
                }).catch(function(error){
                    console.log(error)
                })
                if (intersection) {
                    axios.post(`http://localhost:3004/points/`, {
                        title: intersection.geometry.coordinates
                    }).catch(function(error){
                        console.log(error)
                    })
                }

错误:

Cannot bind to the port 3005. Please specify another port number either through --port argument or through the json-server.json configuration file
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! api@1.0.0 start: `json-server -p 3005 -w db.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the api@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\knowledge.seeker\AppData\Roaming\npm-cache\_logs\2019-12-04T12_57_52_932Z-debug.log

0 个答案:

没有答案