2016-02-12 13:24:01 +00:00
|
|
|
var express = require('express'), path = require('path'), http = require('http'), ejs = require('ejs'), morgan = require('morgan'), cookieparser = require('cookie-parser'), session = require('express-session');
|
|
|
|
var methodoverride = require('method-override'), bodyparser = require('body-parser'), errorhandler = require('errorhandler');
|
2015-08-12 12:17:33 +00:00
|
|
|
var app = express();
|
|
|
|
var lastcheck = 0;
|
|
|
|
var btcCache = {}, fxCache = {};
|
|
|
|
|
2016-02-12 13:24:01 +00:00
|
|
|
//app.configure(function () {
|
2015-08-12 12:17:33 +00:00
|
|
|
app.set('port', 9002);
|
2016-02-12 13:24:01 +00:00
|
|
|
app.use(morgan('combined'));
|
|
|
|
app.use(cookieparser('your secret here'));
|
|
|
|
app.use(session({
|
|
|
|
secret: '1234567890QWERTY', resave: false,
|
|
|
|
saveUninitialized: false
|
|
|
|
}));
|
|
|
|
/* 'default', 'short', 'tiny', 'dev' */
|
|
|
|
app.use(methodoverride());
|
|
|
|
|
|
|
|
app.use(bodyparser.urlencoded({extended: false}));
|
|
|
|
|
|
|
|
// parse application/json
|
|
|
|
app.use(bodyparser.json());
|
|
|
|
|
|
|
|
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);
|
2015-08-12 12:17:33 +00:00
|
|
|
app.use(express.static(path.join(__dirname, 'html')));
|
2016-02-12 13:24:01 +00:00
|
|
|
|
|
|
|
app.use(errorhandler({dumpExceptions: true, showStack: true}));
|
2015-08-12 12:17:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-12 13:24:01 +00:00
|
|
|
//});
|
2015-08-12 12:17:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* create the server
|
|
|
|
*/
|
|
|
|
http.createServer(app).listen(app.get('port'), function () {
|
|
|
|
console.log("Express server listening on port " + app.get('port'));
|
|
|
|
});
|