wai-middleware-static-embedded: Serve embedded static files as a Wai middleware

[ bsd3, library, web ] [ Propose Tags ]

Please see README.md

[Skip to Readme]
Versions [faq]
Dependencies base (>=4.7 && <5), bytestring, cryptonite, http-types, memory, mime-types, text, wai, wai-extra [details]
License BSD-3-Clause
Copyright Copyright: (c) 2017 Adam Sandberg Eriksson
Author Adam Sandberg Eriksson
Maintainer adam@sandbergericsson.se
Revised Revision 1 made by adamse at 2017-04-30T16:57:16Z
Category Web
Home page https://github.com/adamse/wai-middleware-static-embedded#readme
Source repo head: git clone https://github.com/adamse/wai-middleware-static-embedded
Uploaded by adamse at 2017-04-27T21:12:43Z
Distributions NixOS:
Downloads 857 total (4 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2017-04-27 [all 1 reports]




Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees

Readme for wai-middleware-static-embedded-

[back to package description]

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!")