Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soundtrackyourbrand/route
Elixir macro for routing to multiple routers from phoenix endpoint (or a plug router)
https://github.com/soundtrackyourbrand/route
Last synced: about 2 months ago
JSON representation
Elixir macro for routing to multiple routers from phoenix endpoint (or a plug router)
- Host: GitHub
- URL: https://github.com/soundtrackyourbrand/route
- Owner: soundtrackyourbrand
- License: mit
- Created: 2018-01-18T18:10:34.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-10T11:28:42.000Z (about 6 years ago)
- Last Synced: 2024-11-17T17:49:41.939Z (2 months ago)
- Language: Elixir
- Homepage:
- Size: 13.7 KB
- Stars: 11
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Route
[![Build Status](https://api.travis-ci.org/soundtrackyourbrand/route.svg)](https://travis-ci.org/soundtrackyourbrand/route)
[![Inline docs](http://inch-ci.org/github/soundtrackyourbrand/route.svg)](http://inch-ci.org/github/soundtrackyourbrand/route)Elixir macro for routing to multiple routers from phoenix endpoint (or a plug router)
[Documentation for route is available online](https://hexdocs.pm/route/).
## Example
```elixir
defmodule Endpoint do
use Phoenix.Endpoint, otp_app: :my_app
use Routeroute path: "/admin", to: Admin.Router
route host: "api.", to: API.Router
route to: Web.Router
enddefmodule API.Router do
use MyApp.Web, :routerget "/" do
resp(conn, 200, "hello api")
end
enddefmodule Web.Router do
use MyApp.Web, :routerget "/" do
resp(conn, 200, "hello web")
end
enddefmodule Web.Admin do
use MyApp.Web, :routerget "/" do
resp(conn, 200, "hello admin")
end
end```
## Installation
Add route to your `mix.exs` dependencies:
```elixir
def deps do
[{:route, "~> 1.0"}]
end
```