Created
January 6, 2012 17:36
-
-
Save lezhangxyz/1571595 to your computer and use it in GitHub Desktop.
server.js
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
// 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