Hello,
I have an issue with the PUT request and I don't understand why. The get request works perfectly and the query too.
Here is the watch screen.


And here is the service.js

and the controller.js

Do you know what is the trouble ?
Thanks in advance !
Hi,
I think it's because the id is passed as a query param (?id=1), PUT /dishes/1 should work.
I don't know though how to fix the JS code so that it's not passed as a query param.
Hi Typicode,
You're right, I have tried it manualy and it worked. I still don't know how to fix it with JS but it's another trouble.
Thank you very much!
Hi, I am new to use json server.
I am using it for multiple files. In module solution scenario i am facing the same issue, like for PUT and PATCH without any id it is giving 400.
//server.js file
//for 200 i am sending some custom response depends on conditions

//endpoints not working

//endpoint working

@typicode @AdamCook44 is there anything i am missing here?
Most helpful comment
Hi,
I think it's because the id is passed as a query param (
?id=1),PUT /dishes/1should work.I don't know though how to fix the JS code so that it's not passed as a query param.