🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@nanoexpress/middleware-static-serve

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nanoexpress/middleware-static-serve

Static file serve middleware for nanoexpress

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
9
-70%
Maintainers
1
Weekly downloads
 
Created
Source

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

NameTypeDescription
pathStringPath of your static serve folder
optionsObjectSee Options

Options

Options nameDefaultRequiredDescription
options.modecachedNoServe mode*, has two values - Cached and Live
options.indexindex.htmlNoIndex filename
options.forcePrettyfalseNoForce appending index-file path
options.addPrettyUrltrueNoEnable pretty url by auto-appending index-file
options.lastModifiedtrueNoEnable browsers Last-modified check
options.compressedtrueNoCompress 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

Keywords

nanoexpress

FAQs

Package last updated on 02 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts