Rinser/pipes-server.js

36 lines
1005 B
JavaScript
Raw Normal View History

2015-08-12 12:17:33 +00:00
var express = require('express'), path = require('path'), http = require('http') ;
var app = express();
var lastcheck = 0;
var btcCache = {}, fxCache = {};
app.configure(function () {
app.set('port', 9002);
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, 'html')));
app.use(express.errorHandler({dumpExceptions: true, showStack: true}));
});
/**
* create the server
*/
http.createServer(app).listen(app.get('port'), function () {
console.log("Express server listening on port " + app.get('port'));
});