wai-app-static-3.1.9: WAI application for static serving
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.Wai.Application.Static

Description

Static file serving for WAI.

Synopsis

WAI application

staticApp :: StaticSettings -> Application Source #

Turn a StaticSettings into a WAI application.

Default Settings

defaultWebAppSettings Source #

Arguments

:: 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.

webAppSettingsWithLookup Source #

Arguments

:: 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.

defaultFileServerSettings Source #

Arguments

:: 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)] -> StaticSettings Source #

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

Settings

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 LookupResult Source #

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 -> ByteString Source #

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 MimeType Source #

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 Listing Source #

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 -> MaxAge Source #

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

ssRedirectToIndex :: StaticSettings -> Bool Source #

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.

ssAddTrailingSlash :: StaticSettings -> Bool Source #

Force a trailing slash at the end of directories

ss404Handler :: StaticSettings -> Maybe Application Source #

Optional Application to be used in case of 404 errors

Since 3.1.3