var express = require('express'), path = require('path'), http = require('http') ; var app = express(); GLOBAL.lastcheck = 0; var btcCache = {}, fxCache = {} , trainCache = {}; app.configure(function () { app.set('port', process.env.PORT || 4545); app.set('view engine', 'ejs'); app.use(express.logger('dev')); app.use(express.cookieParser()); app.use(express.session({secret: '1234567890QWERTY'})); /* '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, 'app'))); app.use(express.errorHandler({dumpExceptions: true, showStack: true})); app.get('/temp', function (req, res) { res.render('pages/temp'); }); app.get('/weight', function (req, res) { res.render('pages/weight'); }); }); /** * create the server */ http.createServer(app).listen(app.get('port'), function () { console.log("Express server listening on port " + app.get('port')); });