This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
module.exports = http.createServer(function(req, res) { | |
res.writeHead(200); | |
res.end('Hello World'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var multipart = require('multipart'); | |
var fs = require('fs'); | |
var app = express.createServer(); | |
app.configure(function() { | |
app.use(express.logger()); | |
app.use(express.bodyDecoder()); | |
app.use(express.methodOverride()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'), | |
sys = require('sys'), | |
fs = require('fs'), | |
io = require('socket.io'), | |
fugue = require('fugue'); | |
var server = http.createServer(function(request, response) { | |
response.writeHead(200, { | |
'Content-Type': 'text/html' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var products = [ | |
{ | |
id: 1, | |
name : 'Mac Book Pro', | |
description: 'Apple 13 inch Mac Book Pro Notebook', | |
price: 1000 | |
}, | |
{ | |
id: 2, | |
name : 'iPad', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express.createServer(); | |
app.configure('development', function () { | |
app.use(express.logger()); | |
app.use(express.errorHandler({ | |
dumpExceptions: true, | |
showStack: true | |
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'), | |
sys = require('sys'), | |
fs = require('fs'), | |
io = require('socket.io'); | |
var server = http.createServer(function(request, response) { | |
response.writeHead(200, { | |
'Content-Type': 'text/html' | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var db1 = initialize_connection_1(); | |
var db2 = initialize_connection_2(); | |
http.createServer(function (request, response) { | |
var all_results = []; | |
var replied = false; | |
var try_reply = function(result, force) { | |
all_results.push(result); | |
if (!replied && (all_results.length == 2 || force)) { | |
replied = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node app.js | |
booted | |
11 Oct 19:16:40 . Accepted 127.0.0.1:1460 | |
Using master socket path: /tmp/fugue_397_master.sock | |
Starting new master... | |
Spawning workers... | |
spawned. | |
booted | |
11 Oct 19:16:40 . Accepted 127.0.0.1:1461 | |
Using master socket path: /tmp/fugue_397_master.sock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* create socket */ | |
serverSocket = socket(...); | |
/* bind the socket to an address and port */ | |
bind(serverSocket, ...); | |
/* socket will listen for incoming connections */ | |
listen(serverSocket, ...); | |
listen_fds = []; | |
listen_fds << serverSocket; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* create socket */ | |
serverSocket = socket(...); | |
/* bind the socket to an address and port */ | |
bind(serverSocket, ...); | |
/* socket will listen for incoming connections */ | |
listen(serverSocket, ...); | |
for(;;) { |