class Zipstream::StaticFileHandler

Overview

A simple handler that lists directories and serves files under a given public directory.

Included Modules

Defined in:

zipstream/http/server/handlers/static_file_handler.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(public_dir : String, fallthrough = true, directory_listing = true, match_hidden : Bool = false, follow_symlinks : Bool = false) #

Creates a handler that will serve files in the given public_dir, after expanding it (using File#expand_path).

If fallthrough is false, this handler does not call next handler when request method is neither GET or HEAD, then serves 405 Method Not Allowed. Otherwise, it calls next handler.

If directory_listing is false, directory listing is disabled. This means that paths matching directories are ignored and next handler is called.

If match_hidden is true the pattern will match hidden files and folders. If follow_symlinks is true the pattern will follow symlinks.


[View source]

Instance Method Detail

def call(context) : Nil #

[View source]