airbnb/rendr — pull request #45 by technicolorenvy (2013-05-16 04:39:58+00:00)
Title: Multiple api hosts

in response to ticket #44

this pull request allows the following you to declare multiple api hosts in your config file

apis: {
"main": {
host: "localhost",
protocol: "http",
port: "3022"
},
"api_one": {
host: "fancyapi.foo.com",
protocol: "https"
},
"api_two": {
host: "fancyapi.bar.com",
protocol: "http"
}
}

If you wish to use the 'main' api your model need only have a url and the rest will get picked up

module.exports = Base.extend({
url: '/users',
idAttribute: 'id'
});

will attempt to fetch data from `http://localhost:3022/users`

however, should you wish to use another api host your model may look more like the following

module.exports = Base.extend({
url: '/baz',
idAttribute: 'id',
apiHost: 'api_one'
});

now, given the above snippets, the server will attempt to fetch data from `https://fancyapi.foo.com/baz`