lws-static
Version:
Lws middleware wrapper for koa-static
28 lines (21 loc) • 1.87 kB
Markdown
[](https://www.npmjs.org/package/lws-static)
[](https://www.npmjs.org/package/lws-static)
[](https://github.com/lwsjs/static/network/dependents?dependent_type=REPOSITORY)
[](https://github.com/lwsjs/static/network/dependents?dependent_type=PACKAGE)
[](https://github.com/lwsjs/static/actions/workflows/node.js.yml)
[](https://github.com/feross/standard)
# lws-static
Lws middleware plugin to serve static files, wraps [koa-static](https://github.com/koajs/static). See [here](https://github.com/lwsjs/local-web-server/wiki/How-to-serve-static-files) for usage instrutions.
Adds the following options to `lws`.
<pre><code>
--directory, -d <u>path</u> Root directory, defaults to the current directory.
--static.maxage <u>number</u> Cache max-age (in seconds) applied to all resources served.
--static.defer If true, serves after `await next`, allowing any downstream middleware to
respond first.
--static.index <u>path</u> Default file name, defaults to `index.html`.
--static.extensions <u>ext</u> One or more default filename extensions. For example, if you set
`--static.extensions html` and request `/page` then the server will look for
both `page` and `page.html` on disk, serving the latter.
</pre></code>
* * *
© 2016-24 Lloyd Brookes \<75pound@gmail.com\>.