Skip to content

Commit

Permalink
... and rest_server.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrencepit committed Jul 30, 2008
1 parent 9fb5565 commit bfdd091
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions foundation/rest_server.js
@@ -0,0 +1,37 @@
// ========================================================================
// SproutCore
// copyright 2006-2008 Sprout Systems, Inc.
// ========================================================================

require('core') ;

/** @namespace SC.RESTServer
Implements a REST client communicating in a RESTful manner with a backend server.
*/
SC.RESTServer = SC.Server.extend({

urlFor: function(resource, action, ids, params, method) {
url = resource;
if (ids && ids.length == 1) url = url + '/' + ids[0];
if (action && action != '') url = url + '/' + action;
return url;
},

_listForAction: '',
_listForMethod: 'get',

_createAction: '',
_createMethod: 'post',

_refreshAction: '',
_refreshMethod: 'get',

_commitAction: '',
_commitMethod: 'put',

_destroyAction: '',
_destroyMethod: 'delete'

}) ;

0 comments on commit bfdd091

Please sign in to comment.