mirror of
https://gitlab.silvrtree.co.uk/martind2000/old-silvrgit.git
synced 2025-01-10 17:25:09 +00:00
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
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'));
|
|
});
|