Skip to content

Instantly share code, notes, and snippets.

@m3talsmith
Last active December 23, 2015 19:19
Show Gist options
  • Save m3talsmith/6681282 to your computer and use it in GitHub Desktop.
Save m3talsmith/6681282 to your computer and use it in GitHub Desktop.
Trying to get restful responses from chicago boss
-module(cbhellorest_greetings_controller, [Req]).
-compile(export_all).
hello('GET', []) ->
{json, [{message, "hey"}]};
hello('POST', []) ->
NewGreeting = greeting:new(id, Req:post_params("message")),
{ok, SavedGreeting} = NewGreeting.save(),
{json, [{message, SavedGreeting:attributes}]}.
-module(greeting, [Id, Message]).
-compile(export_all).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment