Yes. For example, code returns findOne and log:
- Recipe
= can.Model.extend({
destroy : "DELETE /collection/{id}",
findOne : "GET /collection/{id}"
},{}); - Recipe.findOne({id:
121}, function(recipe){
console.log(recipe);
});
Log:
- GET http://localhost/collection/121
Server return: - [{"id":121,"created":1416865621,"updated":1416862021,"visible":0,"name":"N 0.8726805504271906","sort":0,"color":0}]
In console.log(recipe); - a { 0=a, _data={...}, _cid=".map3", ...}
And my RESTful interface (PHP):
-
function get() {
// a lot of code
if($result)
print json_encode($result, JSON_UNESCAPED_UNICODE);
else
return $this->f3->error(400);
}
function delete() {
// a lot of code
if($this->collection->delete($this->collection_id))
return $this->f3->status(200);
else
return $this->f3->error(400);
}