Module: Utopia::Static

Defined in:
lib/utopia/static/local_file.rb,
lib/utopia/static.rb,
lib/utopia/static/middleware.rb,
lib/utopia/static/mime_types.rb

Overview

A middleware which serves static files from the specified root directory.

Defined Under Namespace

Classes: LocalFile, Middleware, MimeTypeLoader

Constant Summary collapse

DEFAULT_CACHE_CONTROL =
"public, max-age=3600".freeze
MIME_TYPES =

Default mime-types which are common for files served over HTTP:

{
	:xiph => [
		"ogx", "ogv", "oga", "ogg", "spx", "flac", "xspf"
	],
	:media => [
		:xiph, "mp3", "mp4", "wav", "aiff", "aac", "webm", "weba", "mov", "avi", "wmv", "mpg", "m3u8", "ts"
	],
	:text => [
		"html", "css", "js", "map", "txt", "rtf", "xml", "pdf"
	],
	:fonts => [
		"otf", "eot", "ttf", "woff", "woff2"
	],
	:archive => [
		"zip", "tar", "tgz", "gz", "bz2", "dmg", "torrent"
	],
	:images => [
		"png", "gif", "jpeg", "tiff", "svg", "webp"
	],
	:default => [
		:media, :text, :archive, :images, :fonts
	]
}

Class Method Summary collapse

Class Method Details

.newObject

Construct static-file middleware.



12
13
14
# File 'lib/utopia/static.rb', line 12

def self.new(...)
	Middleware.new(...)
end