Skip to content

Instantly share code, notes, and snippets.

@miguelbermudez
Created December 23, 2025 17:00
Show Gist options
  • Select an option

  • Save miguelbermudez/f8ce6819c281814674da6fd3ba694b2b to your computer and use it in GitHub Desktop.

Select an option

Save miguelbermudez/f8ce6819c281814674da6fd3ba694b2b to your computer and use it in GitHub Desktop.
Sinatra-like in Elixir
#!/usr/bin/env elixir
Mix.install([{:bandit, "~> 1.8"}])
defmodule Router do
use Plug.Router
plug :match
plug :dispatch
def run do
Bandit.start_link(plug: Router)
Process.sleep(:infinity)
end
get "/" do
send_resp(conn, 200, "HELLO")
end
match _ do
send_resp(conn, 404, "Not found")
end
end
Router.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment