Skip to content

Returns Express middleware that serves a service worker that resets any previously set service worker configuration. Useful for development.

License

Notifications You must be signed in to change notification settings

itgalaxy/noop-service-worker-middleware

Repository files navigation

noop-service-worker-middleware

NPM version Travis Build Status dependencies Status devDependencies Status Greenkeeper badge

Returns Express middleware that serves a service worker that resets any previously set service worker configuration. Useful for development.

Installation

npm i -D noop-service-worker-middleware

API

const noopServiceWorkerMiddleware = require("noop-service-worker-middleware");

noopServiceWorkerMiddleware(path)

Returns Express middleware that serves a service worker that resets any previously set service worker configuration.

Options

path

Filename of service worker.

app.use(noopServiceWorkerMiddleware("/custom-service-worker.js"));

Examples

Simple

const express = require("express");
const noopServiceWorkerMiddleware = require("noop-service-worker-middleware");

const app = express();

app.use(noopServiceWorkerMiddleware());

app.get("/", (req, res) => {
  res.send("hello, world!");
});

Webpack Dev Server

const noopServiceWorkerMiddleware = require("noop-service-worker-middleware");

module.exports = {
  // ...
  devServer: {
    before(app, server) {
      app.use(noopServiceWorkerMiddleware());
    }
    // ...
  }
  // ...
};

Thanks

Changelog

Changelog

License

MIT

About

Returns Express middleware that serves a service worker that resets any previously set service worker configuration. Useful for development.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published