0.0.3 • Published 5 years ago

static-fileserver-middleware v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

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

OptionType
baseUrlString
rootDirString

Justification

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

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago