Created
October 10, 2017 01:11
-
-
Save plutov/e44383591600749ac259a36355a0bac7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Elixirrest.Api do | |
use Maru.Router | |
alias Elixirrest.Agent, as: Store | |
namespace :items do | |
desc "get all items" | |
get do | |
Store.get |> json | |
end | |
desc "creates an item" | |
params do | |
requires :name, type: String | |
end | |
post do | |
Store.insert(params) |> json | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment