-
Notifications
You must be signed in to change notification settings - Fork 3
/
routes.jl
executable file
·20 lines (15 loc) · 1.04 KB
/
routes.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using Genie.Router
using Genie.Requests
using ItemsController: items
route("/") do
serve_static_file("welcome.html")
end
route("/items", () -> items(Val(:view), Val(:GET)); method = GET, named = :get_items)
route("/items", () -> items(Val(:view), Val(:POST)); method = POST, named = :post_items)
route("/items/:id", () -> items(Val(:view), Val(:GET), payload(:id)); method = GET, named = :get_items_id)
route("/items/:id", () -> items(Val(:view), Val(:POST), payload(:id)); method = POST, named = :post_items_id)
route("/api/items", () -> items(Val(:api), Val(:GET)); method = GET, named = :get_api_items)
route("/api/items", () -> items(Val(:api), Val(:POST)); method = POST, named = :post_api_items)
route("/api/items/:id", () -> items(Val(:api), Val(:GET), payload(:id)); method = GET, named = :get_api_items_id)
route("/api/items/:id", () -> items(Val(:api), Val(:PUT), payload(:id)); method = PUT, named = :put_api_items_id)
route("/api/items/:id", () -> items(Val(:api), Val(:DELETE), payload(:id)); method = DELETE, named = :delete_api_items_id)