Skip to content
This repository was archived by the owner on Aug 19, 2026. It is now read-only.
soundtrackyourbrandPublic archive

About

Elixir macro for routing to multiple routers from phoenix endpoint (or a plug router)

Topics

Resources

Stars

11 stars

Watchers

9 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Route

Build Status Inline docs

Elixir macro for routing to multiple routers from phoenix endpoint (or a plug router)

Documentation for route is available online.

Example

defmodule Endpoint do
  use Phoenix.Endpoint, otp_app: :my_app
  use Route

  route path: "/admin", to: Admin.Router
  route host: "api.", to: API.Router
  route to: Web.Router
end

defmodule API.Router do
  use MyApp.Web, :router

  get "/" do
    resp(conn, 200, "hello api")
  end
end

defmodule Web.Router do
  use MyApp.Web, :router

  get "/" do
    resp(conn, 200, "hello web")
  end
end

defmodule Web.Admin do
  use MyApp.Web, :router

  get "/" do
    resp(conn, 200, "hello admin")
  end
end

Installation

Add route to your mix.exs dependencies:

def deps do
  [{:route, "~> 1.0"}]
end

About

Elixir macro for routing to multiple routers from phoenix endpoint (or a plug router)

Topics

Resources

Stars

11 stars

Watchers

9 watching

Forks

Releases

Packages

Contributors

Languages