npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sails-hook-maintenance-mode

v0.2.0

Published

Sails JS hook to supply a simple maintenance mode for sites.

Readme

sails-hook-maintenance-mode

Sails JS hook to provide a simple "maintenance mode" for an app, toggleable with an environment variable. In maintenance mode, all requests receive an "under maintenance" page or message in response.

Installation

npm install sails-hook-maintenance-mode

Usage

To lift an app in maintenance mode, set the MAINTENANCE_MODE environment variable to "true".

MAINTENANCE_MODE=true sails lift

Configuration

By default, configuration lives in sails.config['maintenance-mode']. The configuration key (maintenance-mode) can be changed by setting sails.config.hooks['sails-hook-maintenance-mode'].configKey.

Parameter | Type | Default | Details -------------- | ------------------- | ------- | :---------------------------------: envVar | ((string)) | MAINTENANCE_MODE | Environment variable to check view | ((string)) | none | View to display in maintenance mode. If not provided, the hook will use the views/maintenance.ejs view if your app has one. Otherwise, it will show a default maintenance page. Set to false to display text or JSON instead of a view (see text_message and json_message options) viewLocals | ((dictionary)) | {} | Locals and options to use with your maintenance view. You can use this to change up the message per environment, or to provide a different layout. whitelistUrls | ((array)) | none | Array of strings or regular expressions to match a requested URL against. If the URL matches anything in the whitelist, it will bypass maintenance mode and be allowed to proceed. Useful for keeping certain sections of a site (like a contact page or FAQ) live. status | ((number)) | 503 (service unavailable) | Status code to respond with in maintenance mode. jsonMessage | ((json)) | none | If view is set to false and json_message is provided, the res.json method will be used with that value for the response in maintenance mode. textMessage | ((string)) | none | If view is set to false and text_message is provided (and json_message is not provided), the res.send method will be used with that value for the response in maintenance mode. backdoorOnParam | ((string)) | none | Parameter which can be used to unlock maintenance mode for a single session. Use this to test updates to the site while the rest of the world still sees the maintenance page. backdoorOffParam | ((string)) | none | Parameter which can be used to re-instate maintenance mode for a session after the backdoor_on_param has been used.

Example

// [your-sails-app]/config/env/production.js
module.exports = {
  'maintenance-mode': {
    envVar: 'MAINTENANCE',
    view: false,
    textMessage: "Site currently under maintenance, please try again later."
    backdoorOnParam: 'open_sesame',
    backdoorOffParam: 'close_sesame',
    status: 200
  }
};