forked from novaframework/rebar3_nova
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.erl
More file actions
28 lines (24 loc) · 701 Bytes
/
router.erl
File metadata and controls
28 lines (24 loc) · 701 Bytes
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
-module({{name}}_router).
-behaviour(nova_router).
-export([
routes/1
]).
%% The Environment-variable is defined in your sys.config in {nova, [{environment, Value}]}
routes(Environment) ->
[
#{
prefix => "",
security => false,
routes => base_routes() ++ dev_routes(Environment)
}
].
base_routes() ->
[
{"/", fun {{name}}_main_controller:index/1, #{methods => [get]}},
{"/healthz", fun {{name}}_health_controller:healthz/1, #{methods => [get]}},
{"/readyz", fun {{name}}_health_controller:readyz/1, #{methods => [get]}}
].
dev_routes(dev) ->
[{"/assets/[...]", "assets"}];
dev_routes(_) ->
[].