createData
Creates records in the store. It can serve as a requestHandler.
    Store.createData(request, response)
  
  Creates records in the store. It can serve as a requestHandler. The example will store the the object in the data parameter in the store.
import {QueryLogic, fixture, ajax} from "can";
const todoStore = fixture.store(
  [],
  new QueryLogic({ identity: ["id"] })
);
fixture( "POST /todos", (req, res) => {
  todoStore.createData(req, res);
} );
const ajaxSettings = {
  url: "/todos",
  type: "POST",
  data: {name:"Write examples!"}
};
ajax(ajaxSettings).then(result => {
  console.log(result); //-> {id: 1, name: "Write examples!"}
});
Parameters
- request {object}:An HTTP Request object 
- response {object}:An HTTP response object. 
 GitHub
GitHub Twitter
Twitter