wai-app-static- WAI application for static serving

Safe HaskellNone




Static file serving for WAI.


WAI application

staticApp :: StaticSettings -> ApplicationSource

Turn a StaticSettings into a WAI application.

Default Settings



:: FilePath

root folder to serve from

-> StaticSettings 

Settings optimized for a web application. Files will have aggressive caching applied and hashes calculated, and indices and listings are disabled.



:: FilePath

root folder to serve from

-> ETagLookup 
-> StaticSettings 

Same as defaultWebAppSettings, but additionally uses a specialized ETagLookup in place of the standard one. This can allow you to cache your hash values, or even precompute them.



:: FilePath

root folder to serve from

-> StaticSettings 

Settings optimized for a file server. More conservative caching will be applied, and indices and listings are enabled.

embeddedSettings :: [(FilePath, ByteString)] -> StaticSettingsSource

Serve the list of path/content pairs directly from memory.


data StaticSettings Source

All of the settings available to users for tweaking wai-app-static.

Note that you should use the settings type approach for modifying values. See http://www.yesodweb.com/book/settings-types for more information.

ssLookupFile :: StaticSettings -> Pieces -> IO LookupResultSource

Lookup a single file or folder. This is how you can control storage backend (filesystem, embedded, etc) and where to lookup.

ssMkRedirect :: StaticSettings -> Pieces -> ByteString -> ByteStringSource

Given a requested path and a new destination, construct a string that will go there. Default implementation will use relative paths.

ssGetMimeType :: StaticSettings -> File -> IO MimeTypeSource

Determine the mime type of the given file. Note that this function lives in IO in case you want to perform more complicated mimetype analysis, such as via the file utility.

ssListing :: StaticSettings -> Maybe ListingSource

How to perform a directory listing. Optional. Will be used when the user requested a folder.

ssIndices :: StaticSettings -> [Piece]Source

Ordered list of filenames to be used for indices. If the user requests a folder, and a file with the given name is found in that folder, that file is served. This supercedes any directory listing.

ssMaxAge :: StaticSettings -> MaxAgeSource

Value to provide for max age in the cache-control.

ssRedirectToIndex :: StaticSettings -> BoolSource

If True, send a redirect to the user when a folder is requested and an index page should be displayed. When False, display the content immediately.