var options = require('optimist').argv;
var express = require('express');
var app = express();

app.configure(function(){
  app.set('port', options.port || process.env.PORT || 3000);
});

app.get('/', (function(){
  var started = new Date();
  return function(req,res) {
    res.send({
      started: started,
      uptime: (Date.now() - Number(started)) / 1000
    });
  }
})());

app.listen(app.get('port'), function() {
  console.log('express-app listening on http://localhost:%d', app.get('port'));
});

var options = require('optimist').argv;
var express = require('express');
var app = express();

app.configure(function(){
  app.set('port', options.port || process.env.PORT || 3000);
});

app.get('/', (function(){
  var started = new Date();
  return function(req,res) {
    res.send({
      started: started,
      uptime: (Date.now() - Number(started)) / 1000
    });
  }
})());

console.log('express-app listening on http://localhost:%d', app.get('port'));
app.listen(app.get('port'));

Print the port that will be listened to
Print the port that will be listened to

When listen fails due to address-in-use, its nice to know what address
was in use.
