Open hazeledmands opened 10 years ago
Seems that following your example in the README
// POST/PUT/PATCH/DELETE requests:
var a2 = new Article({id: 2});
a2.title = "This article will be saved eventually...";
a2.body = "Even if the browser is offline right now.";
a2.$save();
Will trigger a POST
to /articles/2
-- so your backend server must support upsert.
I intend to add something to this effect in my PR #78
Assumptions we make include:
GET
/widget
and it returns[{id: 1, note: 'widget 1'}]
, then aGET
for/widget/1
needs to respond{id: 1, note: 'widget 1'}
alsoPOST
endpoint will respond with the full, modified object (or nothing, that works too)POST
endpoints should be idempotent. Making the same request against them multiple times might happen, especially if internet connections are flakey