[Now able to serve the entire web app via the happstack server Dino Morelli **20121129055847 Ignore-this: feab1695b1e0153816a8aa4b423a0bf3 This is important to allow us to make ajax calls from the pages to the server. ] move ./util/resources/data.js ./site/dummy-data.js hunk ./site/index.html 10 - + hunk ./src/hs/vidproj-srv.hs 41 - --[ dir "xml" $ fileServing hunk ./src/hs/vidproj-srv.hs 42 - , unknownResource + , serveDirectory DisableBrowsing ["index.html"] "site" hunk ./src/hs/vidproj-srv.hs 67 - hunk ./src/hs/vidproj-srv.hs 72 - - -{- -bodyPolicy :: BodyPolicy -bodyPolicy = (defaultBodyPolicy "/tmp/" 0 1000 1000) --} - - -{- -fileServing :: ServerPart Response -fileServing = do - decodeBody bodyPolicy - - xmlPath <- path $ \(filename :: String) -> - return $ "resources" filename - - liftIO $ putStrLn $ printf "trying to serve file: %s" xmlPath - - fileFound <- liftIO $ doesFileExist xmlPath - if (fileFound) - then serveFile (asContentType "text/xml") xmlPath - else notFound $ toResponse - ((printf "File not available: %s" xmlPath) :: String) --}