Last active
August 29, 2015 14:01
-
-
Save rcdilorenzo/a659c26c75192a09ff9d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Controller.Main do | |
use Weber.Controller | |
render_when_raise :unauthorized, {:text, 401, "Unauthorized.", []} | |
layout false | |
def action(_, conn) do | |
{:render, [project: "simpleTodo"], []} | |
end | |
def add([body: body], _conn) do | |
{:json, [response: "ok"], [{"Content-Type", "application/json"}]} | |
end | |
def unauthorized(_, _) do | |
raise_and_render :unauthorized | |
# No return needed | |
end | |
def wrong(_, _) do | |
{:redirect, "/"} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment