bamboo 2009.4.26 → 2009.4.27
raw patch · 4 files changed
+48/−49 lines, 4 files
Files
- bamboo.cabal +1/−1
- changelog.md +7/−0
- readme.md +38/−5
- src/Bamboo.hs +2/−43
bamboo.cabal view
@@ -1,5 +1,5 @@ Name: bamboo-Version: 2009.4.26+Version: 2009.4.27 Build-type: Simple Synopsis: A simple blog engine on Hack Description: A simple blog engine on Hack
changelog.md view
@@ -1,3 +1,10 @@+2009.4.27+----------++### Feature++* middleware should be in Main.hs too, so bamboo is just an other middleware that can be plugged into any webapp+ 2009.4.26 ----------
readme.md view
@@ -70,7 +70,7 @@ cabal install happy; cabal install rss; cabal install bamboo -#### get blog starter kit ( template )+#### get a starter kit ( template ) mkdir myblog cd myblog@@ -78,18 +78,51 @@ # get a template to start git clone git://github.com/nfjinjing/bamboo-template.git db -#### create a entry point+#### create an entry point -put these into Main.hs+put this into Main.hs module Main where import Bamboo import Hack.Handler.Hyena - main = run bamboo- + import Hack.Utils+ import Hack.Contrib.ContentType+ import Hack.Contrib.ContentSize+ import Hack.Contrib.ShowExceptions+ import Hack.Contrib.Static+++ import qualified Hack.Contrib.Head as H++ default_content_type = "text/plain; charset=UTF-8"++ middleware_stack = + [ dummy_middleware++ -- completeness+ , content_size+ , content_type default_content_type++ -- debuging+ , show_exceptions Nothing++ -- optimization+ , H.head++ -- static serve+ , static (Just "db/public") ["/theme", "/images", "/plugin", "/favicon.ico"]++ -- real app+ , bamboo+ ]++ app = use middleware_stack dummy_app++ main = run app + #### run ghc --make -O2 Main.hs
src/Bamboo.hs view
@@ -13,49 +13,8 @@ import Hack.Utils import Hack import Hack.Contrib.RawRouter-import Hack.Contrib.ContentType-import Hack.Contrib.ContentSize-import Hack.Contrib.SimpleAccessLogger-import Hack.Contrib.ShowExceptions-import Hack.Contrib.File-import Hack.Contrib.Static-import Hack.Contrib.ShowStatus-import Hack.Contrib.Lambda import qualified Hack.Contrib.Head as H -import Bamboo.Helper.Env hiding (body, not_found, (>))--default_content_type = "text/plain; charset=UTF-8"--middleware_stack = - [ dummy_middleware- - -- completeness- , content_size- , content_type default_content_type- - -- debuging- , show_exceptions Nothing- , show_status- - -- optimization- , H.head-- -- logger- -- , simple_access_logger Nothing- - -- dispatch- -- static serve- , lambda- , static (Just "db/public") ["/theme", "/images", "/plugin", "/favicon.ico"]- - -- real app- , route paths- ]- --app = dummy_app .use middleware_stack--bamboo :: Application-bamboo = app+bamboo :: MiddleWare+bamboo = route paths