Created
August 1, 2015 04:31
-
-
Save keichan34/d2e8a7d938e4ec204522 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 SimpleHelloWorld do | |
import Plug.Conn, only: [resp: 3, halt: 1] | |
def init(_), do: nil | |
def call(%{request_path: request_path} = conn, _) when request_path == "/" do | |
conn | |
|> resp(200, "Hello, world!") | |
|> halt | |
end | |
def call(%{request_path: request_path} = conn, _) when request_path == "/goodbye" do | |
conn | |
|> resp(200, "Goodbye, world!") | |
|> halt | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment