Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including connected with all npm packages installed. Try it out:

var connected = require("connected")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

connected v0.0.2

Error first callback for listening on the server.


This module is born out of an annoyance with the Node core. Every method that receives a callback is called using an error first callback. But this is not the case with servers. When you tell the server to start listening on the given port it can will emit an error event when it failed.


npm install connected --save


var connected = require('connected')
  , http = require('http');

var app = http.createServer(function (req, res) {
  res.end('wobble wobble');

connected(app, 80, function (err) {
  // Received an error because we are not allowed to listen on port 80

And thats it.




RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free