Reputation: 391
I am trying to change the url path for the api end-point as the ember app is connecting to an external api.
Locally my ember app is at localhost, and the api is at localhost:3000.
If I try the following:
DS.RESTAdapter.reopen
namespace: "api"
url: "http://localhost:3003"
And I click on a linkTo helper I get the following error:
No route matches [GET] "/api/tasks
How do I get it to bypass the Rails provided route on localhost:3000 to go straight to the api server? So it should request localhost:3003/api/tasks
instead of localhost:3000/api/tasks
Upvotes: 0
Views: 285
Reputation: 4570
You should be setting the host
, not url
property on RESTAdapter
. For example:
DS.RESTAdapter.reopen
namespace: "api"
host: "http://localhost:3003"
See API reference.
Upvotes: 0
Reputation: 19128
Your problem isn't related to ember routing, but the rails routing. You need to use the namespace
to setup a namespace for your resources in the routes.rb
. Like the following:
namespace :api do
resources :tasks
end
I hope it helps
Upvotes: 0