mirror of
https://github.com/kevin-DL/phoenix_api_template.git
synced 2026-01-12 11:05:13 +00:00
Protect endpoints
This commit is contained in:
@@ -18,6 +18,10 @@ defmodule PhoenixApiTemplateWeb.Router do
|
||||
plug(:accepts, ["json"])
|
||||
end
|
||||
|
||||
pipeline :auth do
|
||||
plug PhoenixApiTemplateWeb.Auth.Pipeline
|
||||
end
|
||||
|
||||
scope "/api", PhoenixApiTemplateWeb do
|
||||
pipe_through(:api)
|
||||
|
||||
@@ -25,4 +29,10 @@ defmodule PhoenixApiTemplateWeb.Router do
|
||||
post("/register", UserController, :create)
|
||||
post("/login", UserController, :sign_in)
|
||||
end
|
||||
|
||||
scope "/api", PhoenixApiTemplateWeb do
|
||||
pipe_through([:api, :auth])
|
||||
|
||||
get "/users/by_id/:id", UserController, :show
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user