Skip to content

Instantly share code, notes, and snippets.

View avnersorek's full-sized avatar

Avner Sorek avnersorek

View GitHub Profile
@avnersorek
avnersorek / supertestForNaught.js
Created May 20, 2014 22:43
This is an example of an express node.js server which can be launched using naught, with an integration test using supertest. Each worker naught runs will test itself on a unique port, and only if passes it will listen in on the main port and join the pool.
var express = require('express');
var supertest = require('supertest');
var mainport = 80;
var app = express();
app.get('/test', function(req, res) { res.send({ 'pid' : process.pid }); } );
function listenToMainport() {
app.listen(mainport, function(){