Permalink
Browse files

fleshing out the readme

  • Loading branch information...
1 parent e66fa67 commit 8e3b86f9e3c22bdef86891d17ec5c10405fa13f2 Matt Parker committed Jul 10, 2010
Showing with 26 additions and 3 deletions.
  1. +26 −3 README.markdown
View
@@ -22,6 +22,11 @@ Note: make sure $HOME/.cabal/bin is in your PATH.
λ cd MyApp
λ bird nest
+ [1 of 2] Compiling MyApp ( MyApp.hs, MyApp.o )
+ [2 of 2] Compiling Main ( Main.hs, Main.o )
+ Linking Main ...
+ λ
+
## Start your app (runs on port 3000)
@@ -45,15 +50,17 @@ Note: make sure $HOME/.cabal/bin is in your PATH.
import Data.String.Utils
get, post, put, delete :: Path -> BirdRouter ()
+
+ get ["droids"] = do
+ body "These aren't the droids you're looking for. Move along."
+ status 404
+
get [] = do
name <- param "name"
body $ "Hello, " ++ (maybe "Bird!" id name)
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
@@ -69,6 +76,22 @@ now:
Nothing to see here. Move along.
+## API
+
+You have four functions to implement: get, post, put, and delete. They each accept a Bird Request.
+
+Inside the function body, you can use the following methods (don't worry, this list will grow):
+
+ param :: String -> String
+ -- ex: for the request GET /droids?name=c3po,
+ -- then `p <- param "name"' would bind the value "c3po" to the variable "p"
+
+ body :: String -> BirdRouter ()
+ -- takes a string and sets the Http Response body to whatever the string contained.
+
+ status :: Integer -> BirdRouter
+ -- takes a number, and sets the HTTP Reponse header "Status" to that number.
+
## Notes
This project is *still* in its infancy. Coming features:

0 comments on commit 8e3b86f

Please sign in to comment.