silvrgit/web-server.min.js
martind2000 3e1087fd70 init
2016-03-08 21:52:21 +00:00

3 lines
1.4 KiB
JavaScript

var express=require("express"),path=require("path"),http=require("http"),fx=require("./lib/fx"),btc=require("./lib/btc"),train=require("./lib/train"),app=express();GLOBAL.lastcheck=0;var btcCache={},fxCache={},trainCache={};app.configure(function(){app.set("port",process.env.PORT||9e3),app.use(express.logger("dev")),app.use(express.cookieParser()),app.use(express.session({secret:"1234567890QWERTY"})),app.use(express.methodOverride()),app.use(express.bodyParser()),app.use(function(e,r,s){r.header("Access-Control-Allow-Origin","*"),r.header("Access-Control-Allow-Headers","X-Requested-With"),s()}),app.use(app.router),app.use(express.static(path.join(__dirname,"app"))),app.use(express.errorHandler({dumpExceptions:!0,showStack:!0})),app.use("/btc",btc.doBTC),app.use("/fx",fx.doFx),app.use("/dbeglq",train.dbe_glq),app.use("/glqdbe",train.glq_dbe),app.use("/lot",function(){var e=require("pg"),r="postgres://pguser:1V3D4m526i@localhost/silver";console.log(r);var s=new e.Client(r),p="select * from lot order by d desc";s.connect(function(e){return e?console.error("could not connect to postgres",e):void s.query(p,function(e,r){return e?console.error("error running query",e):(console.log(r.rows[0].theTime),void s.end())})})})}),http.createServer(app).listen(app.get("port"),function(){console.log("Express server listening on port "+app.get("port"))});
//# sourceMappingURL=web-server.min.js.map