class Bezel::Plug::Static
include Bezel::Plug
Serves the files under the directory from at the path at
(at: "/", from: "priv/static" serves priv/static/app.css as
/app.css), for GET and HEAD; any other request, or a path with no
such file, goes on to the next plug. A directory is never listed.
Refused (passed on, so the router answers them): a path segment that
is empty, . or .., that begins with . (.env, .git), or that
holds \, a NUL or a control character. With only:, the first
segment must be one of those names (["css", "js", "favicon.ico"]).
Each file is answered with its Content-Type (by its extension), an
ETag (from its size and modification time), Last-Modified and
Cache-Control (cache_control:); a request whose If-None-Match
has the ETag, or (without If-None-Match) whose If-Modified-Since
is the Last-Modified sent, is answered 304 Not Modified.
Constants
TYPES: Hash[String, String]
The content types by extension.
Class methods
def self.new(*, at: String, from: String, only: Array[String] = …, cache_control: String = …) -> Bezel::Plug::Static
Serves from's files under at.
def self.http_date(time: Time) -> String
time as an HTTP date: Sun, 06 Nov 1994 08:49:37 GMT.
Methods
def call(conn: Bezel::Conn) -> Bezel::Conn
The connection changed by this plug.
from Bezel::Plug