O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

In this recipe, the static folder is served by quickHttpServe.

Note that in the absence of any route, the static folder serves the contents from the root path. The subfolders are automatically mapped to the subpath. 

Snap prevents access to the parent folder of the static directory, and the absolute paths are also not allowed. The defaultMimeTypes function in the module Snap.Util.FileServe gives a list of the default mime types. It is possible to add your own mime types to the list and serve the directory.

The fancyDirectoryConfig function uses its own built-in style for the listing directory. The defaultDirectoryConfig function shows the directory listing in a plain manner.

Note that the files index.htmlindex.htmdefault.html ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required