This commit is contained in:
@@ -1,15 +1,32 @@
|
||||
defmodule CustomerServiceWeb.Router do
|
||||
use CustomerServiceWeb, :router
|
||||
alias CustomerServiceWeb.CustomerController
|
||||
|
||||
pipeline :api do
|
||||
plug CORSPlug, origin: "*"
|
||||
plug :accepts, ["json"]
|
||||
plug OpenApiSpex.Plug.PutApiSpec, module: CustomerServiceWeb.ApiSpec
|
||||
end
|
||||
|
||||
get("/health", CustomerServiceWeb.HealthController, :health)
|
||||
get("/health/ready", CustomerServiceWeb.HealthController, :ready)
|
||||
|
||||
scope "/api" do
|
||||
pipe_through :api
|
||||
|
||||
resources "/customers", CustomerServiceWeb.Customer, only: [:create, :index, :show]
|
||||
get "/openapi", OpenApiSpex.Plug.RenderSpec, []
|
||||
|
||||
scope "/v1" do
|
||||
post "/customers", CustomerController, :create
|
||||
post "/customers/individual", CustomerController, :create
|
||||
post "/customers/corporate", CustomerController, :create_corporate
|
||||
get "/customers", CustomerController, :index
|
||||
get "/customers/:id", CustomerController, :show
|
||||
end
|
||||
end
|
||||
|
||||
if Mix.env() == :dev do
|
||||
scope "/swaggerui" do
|
||||
get "/", OpenApiSpex.Plug.SwaggerUI, path: "/api/openapi"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user