This file contains hidden or 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 sys = require('sys'), | |
| spawn = require('child_process').spawn, | |
| http = require('http'); | |
| http.createServer(function (request, response) { | |
| response.writeHead(200, {'Content-Type': 'text/plain'}); | |
| var cat = spawn('tail', ['-f', '/var/log/system.log']); | |
| cat.stdout.on('data', function(data) { | |
| response.write(data); | |
| }); |
This file contains hidden or 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 sys = require('sys'), | |
| spawn = require('child_process').spawn, | |
| http = require('http'); | |
| http.createServer(function (request, response) { | |
| response.writeHead(200, {'Content-Type': 'text/plain'}); | |
| var tail = spawn('tail', ['-f', '/var/log/system.log']); | |
| var kill_tail = function() { | |
| tail.kill(); |
This file contains hidden or 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(;;) { |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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' | |
| }); |