UtopiaSourceUtopiaStatic

module Static

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

Nested

Definitions

MIME_TYPES = {...}

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

Implementation

MIME_TYPES = {
	:xiph => {
		"ogx" => "application/ogg",
		"ogv" => "video/ogg",
		"oga" => "audio/ogg",
		"ogg" => "audio/ogg",
		"spx" => "audio/ogg",
		"flac" => "audio/flac",
		"anx" => "application/annodex",
		"axa" => "audio/annodex",
		"xspf" => "application/xspf+xml",
	},
	:media => [
		:xiph, "mp3", "mp4", "wav", "aiff", "aac", "webm", "mov", "avi", "wmv", "mpg", "m3u8", "ts"
	],
	:text => [
		"html", "css", "js", ["map", "application/json"], "txt", "rtf", "xml", "pdf"
	],
	:fonts => [
		"otf", ["eot", "application/vnd.ms-fontobject"], "ttf", "woff", "woff2"
	],
	:archive => [
		"zip", "tar", "tgz", "tar.gz", "tar.bz2", ["dmg", "application/x-apple-diskimage"],
		["torrent", "application/x-bittorrent"]
	],
	:images => [
		"png", "gif", "jpeg", "tiff", "svg", "webp"
	],
	:default => [
		:media, :text, :archive, :images, :fonts
	]
}