Serve static files, subject to a policy that can filter or
modify incoming URIs. The flow is:
incoming request URI ==> policies ==> exists? ==> respond
If any of the polices fail, or the file doesn't
exist, then the middleware gives up and calls the inner application.
If the file is found, the middleware chooses a content type based
on the file extension and returns the file contents as the response.
Serve static files out of the application root (current directory).
If file is found, it is streamed to the client and no further middleware is run. Disables caching.
Note: for security reasons, this uses the noDots and isNotAbsolute policy by default.
Serve static files subject to a Policy. Unlike static and staticPolicy, this
has no policies enabled by default and is hence insecure. Disables caching.
Deprecated. Use staticWithOptions instead. This function will be removed in the next major release.
Serve static files out of the application root (current directory).
If file is found, it is streamed to the client and no further middleware is run. Allows a CachingStrategy.
Note: for security reasons, this uses the noDots and isNotAbsolute policy by default.
Serve static files subject to a Policy. Unlike static and staticPolicy, this
has no policies enabled by default, and is hence insecure. Also allows to set a CachingStrategy.
Serve static files out of the application root (current directory).
If file is found, it is streamed to the client and no further middleware is run. Takes Options.
Note: for security reasons, this uses the noDots and isNotAbsolute policy by default.
A cache strategy which should be used to
serve content matching a policy. Meta information is cached for a maxium of
100 seconds before being recomputed.