Current section

Files

Jump to
thousand_island lib thousand_island handlers http_hello_world.ex
Raw

lib/thousand_island/handlers/http_hello_world.ex

defmodule ThousandIsland.Handlers.HTTPHelloWorld do
@moduledoc """
A sample Handler implementation of a simple HTTP Server. Intended to be the
simplest thing that can answer a browser request and nothing more. Not even
remotely strictly HTTP compliant.
"""
use ThousandIsland.Handler
@impl ThousandIsland.Handler
def handle_data(_data, socket, state) do
ThousandIsland.Socket.send(socket, "HTTP/1.0 200 OK\r\n\r\nHello, World")
{:ok, :close, state}
end
end