Skip to content

Add host constraints to mix phx.routes output #6589

Description

@malteriechmann

We use host constraints in router.ex, e. g.

scope "/", MyAppWeb, host: "api.example.com" do
  pipe_through [:api]
  get "/users", UserController, :index
end

scope "/", MyAppWeb, host: "admin.example.com" do
  pipe_through [:browser]
  get "/users", AdminUserController, :index
end

When running mix phx.routes we get:

GET  /users  MyAppWeb.UserController :index
GET  /users  MyAppWeb.AdminUserController :index

It would be better to get something like that:

[api.example.com]    GET  /users  MyAppWeb.UserController :index
[admin.example.com]  GET  /users  MyAppWeb.AdminUserController :index

If this is interesting for Phoenix framework, I would like to create a pull request for that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions