Skip to content

Instantly share code, notes, and snippets.

@keichan34
Created August 1, 2015 04:31
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 keichan34/d2e8a7d938e4ec204522 to your computer and use it in GitHub Desktop.
Save keichan34/d2e8a7d938e4ec204522 to your computer and use it in GitHub Desktop.
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