defmodule CustomerServiceWeb.Router do use CustomerServiceWeb, :router alias CustomerServiceWeb.CustomerController pipeline :api do 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 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