app.js 706 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * Module dependencies.
  3. */
  4. var express = require('express');
  5. var http = require('http');
  6. var path = require('path');
  7. var app = express();
  8. // all environments
  9. app.set('port', process.env.PORT || 3000);
  10. app.use(express.favicon());
  11. app.use(express.logger('dev'));
  12. app.use(express.json());
  13. app.use(express.urlencoded());
  14. app.use(express.methodOverride());
  15. app.use(express.static(path.join(__dirname, '/public')));
  16. app.use(express.static(path.join(__dirname, '/tests')));
  17. // development only
  18. if ('development' == app.get('env')) {
  19. app.use(express.errorHandler());
  20. }
  21. http.createServer(app).listen(app.get('port'), function(){
  22. console.log('Express server listening on port ' + app.get('port'));
  23. });