Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sigfox/koa-maintenance

Package Overview
Dependencies
Maintainers
5
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sigfox/koa-maintenance

Koa middleware to manage maintenance.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
5
Weekly downloads
 
Created
Source

koa-maintenance

Koa middleware to manage maintenance mode.

When use it?

You can use this module if you need to manage the maintenance mode of your Koa app.

Features

Switch on or off at startup the maintenance mode of your Koa app, if on it will send a 503 status to all incoming requests, if off it will go through the maintenance middleware without modifications of the incoming request. The HTTP status code and the body's response can be customised via the options parameter.

Install

npm install @sigfox/koa-maintenance

Usage

  • isOn (Boolean) (default: "false"): The flag to indicate if the maintenance is on or off, default is off.
  • options (Object) (default: "{ status: 503, message: "We are currently down for maintenance." }"): The options to customise status code and body's response.
const Koa = require('koa');
const maintenance = require('@sigfox/koa-maintenance');

const app = new Koa();
app.use(
  maintenance(process.env.MAINTENANCE === 'true', {
    status: 503,
    message: 'Something amazing is coming, bear with us'
  })
);

const server = app.listen();

Test

npm test

Licence

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 06 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc