Skip to content

Instantly share code, notes, and snippets.

View alvelig's full-sized avatar

Alexander Veligurov alvelig

  • Santiago, Chile
View GitHub Profile
@nemtsov
nemtsov / connect-use-many.js
Created August 4, 2013 01:44
Connect middleware used when you need to combine multiple other middleware into one.
/**
* @param {Array} list of middleware to combine
*/
module.exports = function (list) {
return function (req, res, next) {
(function iter(i) {
var mid = list[i]
if (!mid) return next()
mid(req, res, function (err) {
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active May 20, 2024 11:27
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');