/* var app = require('express').createServer(); app.get('/', function(req, res) { res.send('Hello from AppFog.com'); }); app.listen(process.env.VCAP_APP_PORT || 3000);*/ var express = require('express'), path = require('path'), http = require('http'); var app = express(); app.configure(function() { app.set('port', process.env.VCAP_APP_PORT || 3000); app.use(express.logger('dev')); /* 'default', 'short', 'tiny', 'dev' */ app.use(express.methodOverride()); app.use(express.bodyParser()); app.use(function(req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Headers', 'X-Requested-With'); next(); }); app.use(app.router); app.use(express.static(path.join(__dirname, 'www'))); app.use(express.errorHandler({ 'dumpExceptions': true, 'showStack': true })); }); /** * Routing handlers */ /** * create the server */ http.createServer(app).listen(app.get('port'), function() { console.log(`Express server listening on port ${ app.get('port')}`); });