Extjs application with Json-server does not work well


I have a small app and I am using Rest Proxy. I set up json-server https://github.com/typicode/json-server locally.

I have not changed anything in server settings. I am able to successfully GET data from server but when I try to create data like this

var people = App.model.myModel;

var ed = new people({"id": 2,"title": "test","body": "test"});

Error appears in browser console is

PUT http://localhost:3000/posts/11?_dc=1427464731634 404 (Not Found)

Can some one point out why it is trying to PUT data and not POST data ?

PUT is used to update an item, Not Create.

As you have specified an id value ExtJs will presume that you need to update the record rather than create it, therefore making the PUT request.

Most RESTful API's will provide GET, PUT, POST and sometimes DELETE, LINK Endpoints for each entity.