Nonchalantly Performs Magic

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

    Install

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

    DownloadsWeekly Downloads

    19

    Version

    1.0.1

    License

    UNLICENSED

    Unpacked Size

    2.26 kB

    Total Files

    3

    Last publish

    Collaborators

    • kusmarius
    • djordjeobradovic
    • jelena10
    • kunlun8809
    • shane777
    • stellar_saber
    • xavier.lai
    • stefan1105
    • loicpirezwc
    • draganmijajilovic
    • nebojsapm
    • freeyetiw
    • raohael_biland
    • liyachun01
    • echoyueyu
    • wiredcraft-bot
    • makara
    • xavierchow
    • drakexiang
    • kaleocheng
    • flyingant
    • ccharlieli
    • rankun203
    • superbogy
    • miffyliye
    • lalawow
    • bsdelf
    • shuaibird
    • juhas
    • xiao_t
    • agreatfool
    • chopperlee2011
    • woodpig07
    • dowla
    • eronekogin
    • kuno
    • xpol
    • wangjianting
    • estemomento