Skip to content

Instantly share code, notes, and snippets.

@shankardevy
Last active August 18, 2017 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shankardevy/ed513780139369991bd65544ceef12dd to your computer and use it in GitHub Desktop.
Save shankardevy/ed513780139369991bd65544ceef12dd to your computer and use it in GitHub Desktop.
defmodule MangoWeb.Router do
use MangoWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug MangoWeb.Plugs.LoadCustomer
plug MangoWeb.Plugs.FetchCart
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", MangoWeb do
pipe_through :browser # Use the default browser stack
get "/", PageController, :index
get "/categories/:name", CategoryController, :show
get "/register", RegistrationController, :new
post "/register", RegistrationController, :create
get "/login", SessionController, :new
post "/login", SessionController, :create
get "/logout", SessionController, :delete
post "/cart", CartController, :add
get "/cart", CartController, :show
put "/cart", CartController, :update
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment