Common Lisp Package: CLACK.MIDDLEWARE.STATIC

# Clack.Middleware.Static - Middleware to serve static files. ## SYNOPSIS (run (builder (<clack-middleware-static> :path "/public/" :root #p"/static-files/") app)) ## DESCRIPTION This is a Clack Middleware component for serving static files. ## Slots * path (Required, String or Function) <code>path</code> specifies the prefix of URL or a callback to match with requests to serve static files for. Notice. Don't forget to add slush "/" to the end. * root (Optional, Pathname) <code>root</code> specifies the root directory to serve static files from. ## EXAMPLE The following example code would serve */public/foo.jpg* from */static-files/foo.jpg*. (run (builder (<clack-middleware-static> :path "/public/" :root #p"/static-files/") app)) You can set any function that returns a mapped filename as <code>:path</code>. The above example can be rewritten as following code. (run (builder (<clack-middleware-static> :path (lambda (path) (when (ppcre:scan "^/public/" path) (subseq path 7))) :root #p"/static-files/") app)) ## AUTHOR * Eitarow Fukamachi (e.arrows@gmail.com) ## SEE ALSO * Clack.App.File

README:

FUNCTION

Private

STARTS-WITH-SUBSEQ (PREFIX SEQUENCE &REST ARGS &KEY (RETURN-SUFFIX NIL) &ALLOW-OTHER-KEYS)

Test whether the first elements of SEQUENCE are the same (as per TEST) as the elements of PREFIX. If RETURN-SUFFIX is T the functions returns, as a second value, a displaced array pointing to the sequence after PREFIX.

GENERIC-FUNCTION

Private

Undocumented

CALL-APP-FILE (THIS ENV)

SLOT-ACCESSOR

Private

Undocumented

STATIC-PATH (OBJECT)

SETFSTATIC-PATH (NEW-VALUE OBJECT)

STATIC-ROOT (OBJECT)

SETFSTATIC-ROOT (NEW-VALUE OBJECT)

CLASS

Public

<CLACK-MIDDLEWARE-STATIC>

Clack Middleware to intercept requests for static files.

Private

<CLACK-APP-FILE>

Clack Application to serve static files.