Skip to content

Instantly share code, notes, and snippets.

@lezhangxyz
Created January 6, 2012 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lezhangxyz/1571595 to your computer and use it in GitHub Desktop.
Save lezhangxyz/1571595 to your computer and use it in GitHub Desktop.
server.js
// Define node.js module dependencies
var express = require('express');
// Initialize API services
var app = express.createServer(express.logger());
// Set up static directories
app.configure(function(){
app.use('/',express.static(__dirname));
});
// Initialize the web server
var port = process.env.PORT || 80;
app.listen(port, function(){
console.log("Listening on " + port);
});
// Initialize now.js server
var nowjs = require("now");
var everyone = nowjs.initialize(app);
everyone.now.ping = function(){
everyone.now.pong();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment