Readme for bird-0.0.1
Bird
A sinatra-ish web framework written in haskell, riding on top of Hack.
Why?
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?
Install
$ cabal update && cabal install bird
Note: make sure $HOME/.cabal/bin is in your PATH.
Create an app
$ bird MyApp
Compile your app
$ cd MyApp
$ bird build
Start your app (runs on port 3000)
$ bird run
Try it out
$ curl http://localhost:3000
404 Not Found
Improvise!
-- MyApp.hs
module MyApp where
import Bird
import Data.String.Utils
get, post, put, delete :: Request -> IO Reply
get Request { path = ("howdy":xs) }
= ok $ ("Howdy " ++) $ join ", " xs
get _ = return notFound_
post _ = return notFound_
put _ = return notFound_
delete _ = return notFound_
Notes
This project is still in its infancy. Coming features:
- logging
- support for sending files