Socket
Socket
Sign inDemoInstall

connect-domain

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    connect-domain

Asynchronous error handler for Connect


Version published
Weekly downloads
144
increased by21.01%
Maintainers
1
Install size
3.73 kB
Created
Weekly downloads
 

Readme

Source

About

Asynchronous error handler for Connect

Installation

npm install connect-domain

Usage

var
	connect = require('connect'),
	connectDomain = require('connect-domain');

var app = connect()
	.use(connectDomain())
	.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);

Keywords

FAQs

Last updated on 13 Mar 2013

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc