Serve embedded static files as a Wai middleware https://github.com/adamse/wai-middleware-static-embedded#readme

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by Adam Sandberg Eriksson

Static embedded middleware

A middleware to serve static files from memory. Works particularly well with file-embed.

Example usage

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}

import Network.Wai.Middleware.StaticEmbedded -- This package
import Data.FileEmbed -- file-embed
import Web.Scotty -- scotty

main :: IO ()
main = scotty 1337 $ do
  middleware (static $(embedDir ".")) -- serves the source directory
  notFound (text "404: Not found!")
Used by 1 package:
comments powered byDisqus