README
passing-notes-static
A static file middleware for passing-notes.
Usage
Install passing-notes-static by running:
yarn add passing-notes-static
Then, compose it with other middleware, or at least a default handler:
import {compose} from 'passing-notes'
import serveStatic from 'passing-notes-static'
export default compose(
serveStatic('./'),
() => () => ({status: 404})
)
serveStatic
will resolve files within and relative to the given directory.
When it can't find a file, it will delegate to the next middleware.
Optionally, a baseUrl
can be provided to "mount" the directory to a URL
subpath. This can be used to route different URLs to different directories on
the file system:
import {compose} from 'passing-notes'
import serveStatic from 'passing-notes-static'
export default compose(
serveStatic('./src', '/'),
serveStatic('./images', '/assets/images'),
() => () => ({status: 404})
)