Created
October 20, 2016 21:10
-
-
Save bnhansn/36ebe8d668189671c941660eba525a2b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Sling.Router do | |
| use Sling.Web, :router | |
| pipeline :browser do | |
| plug :accepts, ["html"] | |
| plug :fetch_session | |
| plug :fetch_flash | |
| plug :protect_from_forgery | |
| plug :put_secure_browser_headers | |
| end | |
| pipeline :api do | |
| plug :accepts, ["json"] | |
| plug Guardian.Plug.VerifyHeader, realm: "Bearer" | |
| plug Guardian.Plug.LoadResource | |
| end | |
| scope "/", Sling do | |
| pipe_through :browser | |
| get "/", PageController, :index | |
| end | |
| scope "/api", Sling do | |
| pipe_through :api | |
| post "/sessions", SessionController, :create | |
| delete "/sessions", SessionController, :delete | |
| post "/sessions/refresh", SessionController, :refresh | |
| resources "/users", UserController, only: [:create] | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment