~ihabunek/triglav

ref: 679690ab4802d018b56a1a4ef21d50e8842f3078 triglav/lib/triglav_web/router.ex -rw-r--r-- 1.5 KiB
679690abIvan Habunek Use stored distance in validator 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
defmodule TriglavWeb.Router do
  use TriglavWeb, :router

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_flash
    plug :protect_from_forgery
    plug :put_secure_browser_headers
  end

  pipeline :api do
    plug :accepts, ["json"]
  end

  scope "/", TriglavWeb do
    pipe_through :browser

    get "/", HomeController, :index
    get "/data", HomeController, :data

    scope "/zet", alias: Zet, as: :zet do
      get "/routes", RoutesController, :index
      get "/routes/:id", RoutesController, :detail
      get "/routes/:id/match/:relation_id", RoutesController, :match
      get "/stops", StopsController, :index
      get "/errors/history", ErrorsController, :index
      get "/errors/history/atom", ErrorsController, :atom
    end
  end

  # Other scopes may use custom stacks.
  # scope "/api", TriglavWeb do
  #   pipe_through :api
  # end

  # Enables LiveDashboard only for development
  #
  # 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).
  if Mix.env() in [:dev, :test] do
    import Phoenix.LiveDashboard.Router

    scope "/" do
      pipe_through :browser
      live_dashboard "/dashboard", metrics: TriglavWeb.Telemetry
    end
  end
end