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

[ bsd3, library, web ] [ Propose Tags ]
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 Sun Apr 30 16:57:16 UTC 2017
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 Thu Apr 27 21:12:43 UTC 2017
Distributions NixOS:
Downloads 325 total (6 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-04-27 [all 1 reports]
Hackage Matrix CI

Please see README.md

[Skip to Readme]




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