1.0.5 • Published 9 years ago

express-domain v1.0.5

Weekly downloads
18
License
-
Repository
github
Last release
9 years ago

About

Asynchronous error handler for Express

Installation

npm install express-domain

Usage

var express = require('express')
  , expressDomain = require('express-domain');

var app = express()
  .use(expressDomain())
  .use(function(req, res){
    if (Math.random() > 0.5) {
      throw new Error('Simple error');
    }
    setTimeout(function() {
      if (Math.random() > 0.5) {
        throw new Error('Asynchronous error from timeout');
      } else {
        res.end('Hello from Connect!');
      }
    }, 1000);
  })
  .use(function(err, req, res, next) {
    res.end(err.message);
  });

app.listen(3000);
1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago