Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.