Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Minimal and pluggable boilerplate for express
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
test
.gitignore
.travis.yml
Gruntfile.js
LICENSE
Makefile
README.md
jshint.json
package.json

README.md

h2o

Boilerplate for an express web application

Build Status

Features

  • Use clusters and domains to handle async errors in a configurable manner
  • Ensure uptime by automatically killing and restarting worker processes upon encountering an error
  • Allow full customization of logging and response sending
  • Minimal number of dependencies

Installation

  1. Add h2o as a dependency to your project’s package.json
  2. Run npm install

Usage Examples

See examples/ for express web applications built using h2o.

Documentation

h2o()
    .setAppDefiner(function(app) {...})
    .setLogger(...)
    .setErrorHandler(function(err, req, res, nextNotUsed) {...})
    .setPort(8765)
    .setClusterUse(true)
    .setNumWorkersInCluster(2)
    .run();

setAppDefiner (required)
Must be called with a function that defines the application. The provided function will be called with app provided.

setLogger (required)
Must be called with a logger object that implements info(message), warn(message), error(message), and fatal(message).

setErrorHandler (required)
Must be called with a function that handles any errors that occur. The provided function will be called with (err, req, res, nextNotUsed).

setPort (optional)
Can be called to port that the web application listens on. Defaults to 80.

setClusterUse (optional)
Can be called to set whether a cluster is used or not to. Using a cluster enables a worker process to restart if an error occurs. Defaults to true.

setNumWorkersInCluster (optional)
Can be called to set the number of workers to fork in the cluster. Defaults to the number of CPUs/cores.

Something went wrong with that request. Please try again.