0
votes

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

2
I think your problem is in routes.rb, because the server receives the request, but No route matches. Can you show your rails router configuration? - Marcio Junior
I haven't set up the rails router at all besides ` root to: 'application#index'` - Ecl1pse Armageddon
Please give a look in my answer, and give me know if it solve your problem. - Marcio Junior

2 Answers

0
votes

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

0
votes

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.