Skip to content

Instantly share code, notes, and snippets.

@lasseebert
Created October 17, 2016 20:33
Show Gist options
  • Select an option

  • Save lasseebert/f367e3e4f0ba488b875b9c671349eaee to your computer and use it in GitHub Desktop.

Select an option

Save lasseebert/f367e3e4f0ba488b875b9c671349eaee to your computer and use it in GitHub Desktop.
defmodule MyApp.UserController do
use MyApp.Web, :controller
def create(conn, params) do
attrs = %{email: params["email"]}
{:ok, user} = MyApp.Users.Invite.call(attrs)
{:ok, body} = %{
id: user.id,
email: user.email
}
|> Poison.encode
conn
|> resp(201, body)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment