with database online
we can use Map.get/2
to get the value
we can use Map.get/3
to get the value of a index, or a default value
On config/config.exs
add the config:
On lib/project_web/router.ex
:
This will create all default route for SomeController, running mix phx.routes
we will get:
some_path GET /api/some-route ProjectWeb.SomeController :index
some_path GET /api/some-route/:id/edit ProjectWeb.SomeController :edit
some_path GET /api/some-route/new ProjectWeb.SomeController :new
some_path GET /api/some-route/:id ProjectWeb.SomeController :show
some_path POST /api/some-route ProjectWeb.SomeController :create
some_path PATCH /api/some-route/:id ProjectWeb.SomeController :update
PUT /api/some-route/:id ProjectWeb.SomeController :update
some_path DELETE /api/some-route/:id ProjectWeb.SomeController :delete
We can pass the parameter only
to specify the methods:
First add bamboo to deps on mix.ex
:
On config/config.exs
add:
to use in teste, add the config on config/test.exs
:
On lib/project_web/router.ex
:
Rocketseat: https://rocketseat.com.br/