2024-05-21 16:52:37 +00:00
|
|
|
defmodule JOLWeb.Router do
|
|
|
|
use JOLWeb, :router
|
2024-05-21 16:43:36 +00:00
|
|
|
|
|
|
|
pipeline :browser do
|
|
|
|
plug :accepts, ["html"]
|
|
|
|
plug :fetch_session
|
|
|
|
plug :fetch_live_flash
|
2024-05-21 16:52:37 +00:00
|
|
|
plug :put_root_layout, html: {JOLWeb.Layouts, :root}
|
2024-05-21 16:43:36 +00:00
|
|
|
plug :protect_from_forgery
|
|
|
|
plug :put_secure_browser_headers
|
|
|
|
end
|
|
|
|
|
|
|
|
pipeline :api do
|
|
|
|
plug :accepts, ["json"]
|
|
|
|
end
|
|
|
|
|
2024-08-20 20:50:07 +00:00
|
|
|
pipeline :feeds do
|
|
|
|
plug :accepts, ["xml"]
|
|
|
|
end
|
|
|
|
|
2024-05-21 16:52:37 +00:00
|
|
|
scope "/", JOLWeb do
|
2024-05-21 16:43:36 +00:00
|
|
|
pipe_through :browser
|
|
|
|
|
|
|
|
get "/", PageController, :home
|
2024-08-22 14:16:14 +00:00
|
|
|
get "/tags", TagController, :index
|
2024-07-30 15:46:47 +00:00
|
|
|
get "/archive", PageController, :archive
|
|
|
|
get "/about", PageController, :about
|
|
|
|
get "/now", PageController, :now
|
2024-06-04 18:09:14 +00:00
|
|
|
|
|
|
|
get "/blog", BlogController, :index
|
|
|
|
get "/blog/:slug", BlogController, :show
|
2024-05-21 16:43:36 +00:00
|
|
|
end
|
|
|
|
|
2024-08-20 20:50:07 +00:00
|
|
|
scope "/", JOLWeb do
|
|
|
|
pipe_through :feeds
|
|
|
|
|
|
|
|
get "/feed.xml", FeedController, :feed
|
|
|
|
end
|
2024-05-21 16:43:36 +00:00
|
|
|
|
|
|
|
# Enable LiveDashboard and Swoosh mailbox preview in development
|
2024-05-27 17:18:57 +00:00
|
|
|
if Application.compile_env(:jol, :dev_routes) do
|
2024-05-21 16:43:36 +00:00
|
|
|
# If you want to use the LiveDashboard in production, you should put
|
|
|
|
# it behind authentication and allow only admins to access it.
|
|
|
|
# If your application does not have an admins-only section yet,
|
|
|
|
# you can use Plug.BasicAuth to set up some basic authentication
|
|
|
|
# as long as you are also using SSL (which you should anyway).
|
|
|
|
import Phoenix.LiveDashboard.Router
|
|
|
|
|
|
|
|
scope "/dev" do
|
|
|
|
pipe_through :browser
|
|
|
|
|
2024-05-21 16:52:37 +00:00
|
|
|
live_dashboard "/dashboard", metrics: JOLWeb.Telemetry
|
2024-05-21 16:43:36 +00:00
|
|
|
forward "/mailbox", Plug.Swoosh.MailboxPreview
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|