[more progress on the tutorial jeremy@n-heptane.com**20080707225551] { hunk ./HAppSHspTutorial.lhs 11 -
HAppS (the Haskell Application Server framework) recently got a whole lot more awesome because it now supports HTML templating using HSP (Haskell Server Pages).
- +HAppS (the Haskell Application Server framework) recently got a whole lot more awesome because it now supports HTML templating using HSP (Haskell Server Pages).
hunk ./HAppSHspTutorial.lhs 13 - - hunk ./HAppSHspTutorial.lhs 14 - hunk ./HAppSHspTutorial.lhs 15 - hunk ./HAppSHspTutorial.lhs 18 - hunk ./HAppSHspTutorial.lhs 19 - hunk ./HAppSHspTutorial.lhs 20 - hunk ./HAppSHspTutorial.lhs 21 - hunk ./HAppSHspTutorial.lhs 22 - hunk ./HAppSHspTutorial.lhs 35 - hunk ./HAppSHspTutorial.lhs 40 -This is the basic template for creating a HAppS application using:
+First we have our Main.hs which starts up the dynamic page loading engine, the state engine, and forks of the HTTP service.
+ +> module Main where +> +> import Control.Concurrent +> import HAppS.Server +> import HAppS.State +> import HSP +> import HAppS.Template.HSP +> import HAppS.Template.HSP.Handle +> +> main :: IO () +> main = +> do store <- newStore +> -- control <- startSystemState entryPoint +> tid <- forkIO $ simpleHTTP validateConf $ impl store +> putStrLn "running..." +> waitForTermination +> killThread tid +> -- shutdownSystem control +> destroyStore store + +The impl
function is your typical HAppS-Server impl function, except that it uses the runHSPHandle
function provided by happs-hsp-template.
runHSPHandle
takes four arguments
store
which manages the objects
+ ServerPart a
+The execTemplate
function is responsible for actually invoking a specific template. It takes two arguments:
runHSPHandle
+