@wiredcraft/express-serve-file-middleware

1.0.1 • Public • Published

@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"
        }
      }
    }
  },

Package Sidebar

Install

npm i @wiredcraft/express-serve-file-middleware

Weekly Downloads

1

Version

1.0.1

License

UNLICENSED

Unpacked Size

2.26 kB

Total Files

3

Last publish

Collaborators

  • bsdelf
  • chopperlee2011
  • xiaojie45
  • stefan1105
  • apexblade
  • miffyliye
  • dejandoder
  • linrz
  • koknikol
  • eronekogin
  • aleksandar5595
  • shuaibird
  • dmwc
  • kunlun8809
  • draganmijajilovic
  • wiredcraft-bot
  • xavierchow
  • kaleocheng
  • flyingant
  • juhas