@wiredcraft/express-serve-file-middleware
v1.0.1
Published
express serve file middleware
Downloads
19
Readme
@wiredcraft/express-serve-file-middleware
Serve files with a predefined request path to file path mapping.
Usage
Express:
const createMiddleware = require('@wiredcraft/exporess-serve-file-middleware');
const app = express();
const middleware = createMiddleware({
routeToFiles: {
'/readme': './README.md'
}
});
app.use(middleware);
const server = app.listen(3000);
For loopback v2, add these section to "middleware.json":
"routes:before": {
"@wiredcraft/serve-file-middleware": {
"params": {
"routeToFiles": {
"/readme": "README.md"
}
}
}
},