wai-app-static-1.2.0.4: WAI application for static serving

Safe HaskellNone

Network.Wai.Application.Static

Contents

Description

Static file serving for WAI.

Synopsis

WAI application

Settings

ssFolder :: StaticSettings -> Pieces -> IO FileLookup

Generic, non-WAI code

Mime types

Mime type by file extension

takeExtensions :: FilePath -> [FilePath]

A list of all possible extensions, starting from the largest.

mimeTypeByExt

Arguments

:: MimeMap 
-> MimeType

default mime type

-> FilePath 
-> MimeType 

Finding files

type Pieces = [FilePath]

Directory listings

type Listing = Pieces -> Folder -> IO ByteString

Lookup functions

fileSystemLookup :: FilePath -> Pieces -> IO FileLookup

embeddedLookup :: Embedded -> Pieces -> IO FileLookup

Embedded

Redirecting

Other data types

newtype FilePath

Constructors

FilePath 

Fields

unFilePath :: Text
 

toFilePath :: FilePath -> FilePath

System.Directory functions are a lie: they claim to be using String, but it's really just a raw byte sequence. We're assuming that non-Windows systems use UTF-8 encoding (there was a discussion regarding this, it wasn't an arbitrary decision). So we need to encodedecode the byte sequence tofrom UTF8. That's the use case for fixPathName/unfixPathName. I'm starting to use John Millikin's system-filepath package for some stuff with work, and might consider migrating over to it for this in the future.