How do I specify various URLs in a backbone app?

Viewed 13371

I need one of my backbone models to hit a variety of URLs depending on the type of action being performed. How do I determine the action within the URL function so that I can specify the appropriate URL? For example:

DELETE: /myapipath/itemtype/id/
POST: /myapipath/special-path/
GET: /myapipath/special-path/?code=ABC

I know how to tell the difference between a POST and everything else: this.isNew()

But how do I tell the difference between a DELETE and a GET in a custom model.url function?

Please don't suggest that I change the server-side api. That isn't up to me.

Thanks!

1 Answers
Related