Created
December 23, 2025 17:00
-
-
Save miguelbermudez/f8ce6819c281814674da6fd3ba694b2b to your computer and use it in GitHub Desktop.
Sinatra-like in Elixir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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