Skip to content

Instantly share code, notes, and snippets.

@prio101
Created August 31, 2018 18:45
Show Gist options
  • Save prio101/313e1620ad340f7e1b95d21d390a7ea1 to your computer and use it in GitHub Desktop.
Save prio101/313e1620ad340f7e1b95d21d390a7ea1 to your computer and use it in GitHub Desktop.
defmodule Router.MainRouter do
use Plug.Router
plug :match
plug :dispatch
get "/" do
page = EEx.eval_file("views/index.html.eex")
conn
|> put_resp_content_type("text/html")
|> send_resp(200, page)
end
forward "/sites", to: Router.SitesRouter
match _ do
send_resp(conn, 404, "oops")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment