forked from datagovuk/apiserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.ex
52 lines (39 loc) · 1.36 KB
/
router.ex
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 ApiServer.Router do
use ApiServer.Web, :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", "application/json", "ttl", "application/x-turtle", "csv"]
plug Corsica
plug :allow_jsonp
end
scope "/service", ApiServer do
pipe_through :api
get "/", ApiController, :info
get "/status", ApiController, :status
get "/:theme", ApiController, :info
get "/:theme/distinct", ApiController, :distinct
get "/:theme/distinct/:service", ApiController, :distinct
get "/:theme/sql", ApiController, :theme_sql
get "/:theme/:service/:method", ApiController, :service
get "/:_theme/:_service", ApiController, :service_direct
end
scope "/", ApiServer do
pipe_through :browser
get "/", PageController, :index
get "/about", PageController, :about
get "/documentation", PageController, :docs
get "/stream", PageController, :info
get "/odata", ODataController, :index
get "/odata/service", ODataController, :service
get "/odata/service/:theme", ODataController, :root
get "/:theme", PageController, :theme
get "/:theme/:service", PageController, :service
get "/:theme/:service/docs", PageController, :service_docs
end
end