Skip to content

Instantly share code, notes, and snippets.

@plutov
Created October 10, 2017 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plutov/e44383591600749ac259a36355a0bac7 to your computer and use it in GitHub Desktop.
Save plutov/e44383591600749ac259a36355a0bac7 to your computer and use it in GitHub Desktop.
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