fast-twitch.middlewares.resource
Complete generated reference for fast-twitch.middlewares.resource
Usage and execution boundary
Delegates to the filesystem file implementation. The root is a filesystem path, not a JVM classpath resource root. File options and runtime constraints apply.
(ns application.middleware
(:require [fast-twitch.middlewares.resource :as middleware]))
(defn handler [_]
{:status 200 :headers {"content-type" "text/plain"} :body "Hello"})
(def app (middleware/wrap-resource handler "static" {:url-root "static"}))
This defines the Ring handler portion. Adapt app through routing/ft-handler or pass it to server/listen!; startup instructions and a complete walkthrough show the surrounding project.
Wrapper order and all middleware families. The function reference below preserves the upstream signatures and source links; helper functions do not all share the wrapper's arity.
Upstream function reference
Provides resource-style static asset serving through the file middleware.
resource-request
(resource-request request root-path)
(resource-request request root-path options)
Function.
Attempts to build a static resource response for the current request. Source
wrap-resource
(wrap-resource handler root-path)
(wrap-resource handler root-path options)
Function.
Wraps a handler with static resource serving for a given root path. Source