Hi all,<br>I&#39;m trying to make a web server that manages its own state. The user can issue commands that modifies the state.<br>I did like below but unfortunatly the state is not keep after a command is issued...<br>
What is the right way to do it? Is there any example sites with an internal state with happstack?<br><br><i>data Game = (the state of my game)<br>type NomicServer             = ServerPartT (StateT Game IO)<br><br>launchWebServer :: Game -&gt; IO ()<br>
launchWebServer initialState = do<br>   putStrLn &quot;Starting web server...\nTo connect, drive your browser to \&quot;<a href="http://localhost:8000/Login%5C" target="_blank">http://localhost:8000/Login\</a>&quot;&quot;<br>

   d &lt;- getDataDir<br>   simpleHTTP&#39; unpackStateT nullConf $ server d<br><br><br>server :: FilePath -&gt; ServerPartT (StateT Game IO) Response<br>server d sh = mconcat [fileServe [] d, do<br>                                   decodeBody (defaultBodyPolicy &quot;/tmp/&quot; 4096 4096 4096)<br>

                                   html &lt;- implSite &quot;<a href="http://localhost:8000/" target="_blank">http://localhost:8000/</a>&quot; &quot;&quot; nomicSite<br>                                   return $ toResponse html]<br>
<br>
unpackStateT:: Game -&gt; UnWebT (StateT Game IO) Response -&gt; UnWebT IO Response<br>unpackStateT g w = evalStateT w g<br> <br>--handler for web routes<br>nomicSite :: Site PlayerCommand (NomicServer Html)<br>nomicSite = setDefault (Noop 0) Site {<br>

      handleSite         = \f url -&gt; unRouteT (routedNomicCommands url) f<br>    , formatPathSegments = \u -&gt; (toPathSegments u, [])<br>    , parsePathSegments  = parseSegments fromPathSegments<br>}</i><br><br>Thanks a lot,<br>

Corentin