emu icon indicating copy to clipboard operation
emu copied to clipboard

Define custom URLs for the RestAdapter

Open ajbogh opened this issue 11 years ago • 0 comments

Hello, this is more of a question of whether it's possible to define custom URLs for the REST adapter. I have a bunch of different services run by Microsoft C# websites in which the service URLs can be a number of different things. We can assume one service endpoint might be http://localhost:56814 while another is http://localhost:56700. Also, since Microsoft projects are what they are, I have interesting URLs like "http://localhost:56700/api/Files/recent" that replies with capitalized properties in the JSON response.

[
  {
    "Id":0
    "FileId": 2,
    "FileNumber": "123-abc",
    "Status": "Open",
  }
]

How do I go about telling Emu about custom URLs for a resource, and subsequently load the JSON array into a collection of RecentFiles?

Example idea for override functionality (http://localhost:56700/api/Files/recent):

App.RecentFile = Emu.Model.extend({
  'resourceHost':'http://localhost:56700',
  'resourcePath':'/api/Files',
  'resourceName':'recent',
  'Id':Emu.field("number"),
  'FileId':Emu.field("number"),
  'FileNumber':Emu.field("string"),
  'Status':Emu.field("string")
});

ajbogh avatar Sep 12 '14 00:09 ajbogh