Servy iex

Run Settings
LanguageElixir
Language Version
Run Command
defmodule Servy do def handle(request) do request |> parse |> rewrite_path |> log end def rewrite_path(%{ path: "/wildlife" } = conv) do %{ conv | path: "wildthings" } end def rewrite_path(conv), do: conv def parse(request) do [method, path, _] = request |> String.split("\n") |> List.first |> String.split(" ") %{ method: method, path: path, resp_body: "", status: nil } end def log(conv), do: IO.inspect conv end request = """ GET /wildlife HTTP/1.1 Host: example.com User-Agent: ExampleBrowser/1.0 Accept: */* """ request |> Servy.handle
Editor Settings
Theme
Key bindings
Full width
Lines