@nanoexpress/middleware-static-serve
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

static

Static file serve middleware for nanoexpress

Installation

npm i @nanoexpress/middleware-static-serve
# or
yarn add @nanoexpress/middleware-static-serve

Example

See the examples directory

Usage

ESM Module

import staticServe from '@nanoexpress/middleware-static-serve';

app.use(staticServe('./static'));

CJS Module

const staticServe = require('@nanoexpress/middleware-static-serve/cjs');

app.use(staticServe('./static'));

Arguments

Name Type Description
path String Path of your static serve folder
options Object See Options

Options

Options name Default Required Description
options.mode cached No Serve mode*, has two values - Cached and Live
options.index index.html No Index filename
options.forcePretty false No Force appending index-file path
options.addPrettyUrl true No Enable pretty url by auto-appending index-file
options.lastModified true No Enable browsers Last-modified check
options.compressed true No Compress response/response streams

* - Cached gives better performance, but on refresh gives cached result and uses more RAM. Live mode uses less memory usage, on request responses last version but on high-load applicatins may reduces performance

License

MIT

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @nanoexpress/middleware-static-serve

      Weekly Downloads

      10

      Version

      1.0.4

      License

      MIT

      Unpacked Size

      48.4 kB

      Total Files

      10

      Last publish

      Collaborators

      • dalisoft