Last active
January 4, 2016 21:59
-
-
Save darkofabijan/8685062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.Router do | |
use Phoenix.Router | |
namespace MyApp.Controllers do | |
get "restaurants/:id", Restaurants, :show, as: :restaurant | |
resources :images | |
resources :users, Accounts | |
end | |
# it's probably expected that this would prepend "/api" to all specific and resources routes. | |
namespace MyApp.Controllers.Api do | |
resources :images | |
resources :users, Accounts | |
end | |
namespace MyApp.Controllers.Admin do | |
get "accounts/:id", Users, :show, as: :user | |
delete "accounts/:id", Users, :destroy | |
resources :restaurants | |
end | |
# if namespace nesting is allowed, but question of nesting is already open for resources | |
namespace MyApp.Controllers do | |
get "restaurants/:id", Restaurants, :show, as: :restaurant | |
resources :images | |
resources :users, Accounts | |
namespace Api do | |
resources :images | |
resources :users, Accounts | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment