express-dynamic-static
Middleware to dynamically change the path of express.static at runtime
Why is this useful?
When working with multiple client applications on the same server, each client application may have its own static assets folder. This plugin lets you define the path to the static assets folder at runtime when a route is requested.
A typical use case might be a client-side app and a client-side admin app running on the same server.
Install
npm install express-dynamic-static --save
Example
const express = ;const dynamicStatic = ;const path = ; const app = ;app; app
Options
An initial static path may be passed (default: public
):
const defaultStaticPath = path;const dynamicStatic = defaultStaticPath;