static-fileserver-middleware

0.0.3 • Public • Published

Static Fileserver Middleware

Window Middlware

Serve static files from any route and any folder, like a window into an underlying filesystem.

Installation

yarn install static-fileserver-middleware

Usage

Example app:

var static = require('static-fileserver-middleware');
var app = require('express')();

app.get('/', (r, res) => res.send('<a href="/ok">Files</a>'));
app.use(static({ rootDir: './public' }));

app.listen(3000);

Example with different baseUrl:

var static = require('static-fileserver-middleware');
var app = require('express')();

var baseUrl = '/ok'
app.get('/', (r, res) => res.send('<a href="/ok">Files</a>'));
app.use(baseUrl, static({ baseUrl, rootDir: './public' }));

app.listen(3000);

Options

Option Type
baseUrl String
rootDir String

Justification

The reasoning for making a new library for this was because none of the other ones worked when mounted not at the root.

Readme

Keywords

none

Package Sidebar

Install

npm i static-fileserver-middleware

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

11.7 kB

Total Files

5

Last publish

Collaborators

  • daveankin