A sinatra-ish web framework written in haskell, riding on top of Hack.
Sinatra has a beautiful, simple, elegant syntax, but it's essentially an attempt to bring pattern matching to a language never intended for pattern matching. Why not attempt something similar in a language with not just beautiful pattern matching, but with all the declarative bells and whistles: lazy evaluation, first-class functions, currying, polymorphism?
λ cabal update && cabal install bird
Note: make sure $HOME/.cabal/bin is in your PATH.
λ bird MyApp
λ cd MyApp
λ bird nest
λ bird fly
λ curl http://localhost:3000
404 Not Found
-- MyApp.hs
module MyApp where
import Bird
import Data.String.Utils
get, post, put, delete :: Path -> BirdRouter ()
get ("howdy":xs) = body $ "Howdy " ++ (join ", " xs) ++ "!"
get ["droids"] = do
body "Nothing to see here. Move along."
status 404
get _ = status 404
post _ = status 404
put _ = status 404
delete _ = status 404
now:
λ curl http://localhost:3000/howdy/there/pardna
Howdy there, pardna!
λ curl http://localhost:3000/droids
Nothing to see here. Move along.
This project is still in its infancy. Coming features:
- logging
- support for sending files