diff options
| author | Adam Soltys <[email protected]> | 2014-08-08 11:33:43 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2014-08-08 11:33:43 -0700 |
| commit | 2cc86381a6f79cd729048b34a72b70562a7b0ace (patch) | |
| tree | c42dda997719ce544a4dea2bf15937d293ebfd59 /src/routes/calculator.coffee | |
| parent | 3082e274b70a93fdac8a9a63934252ed914fe406 (diff) | |
| parent | 6d5c3a56067b96bb5d97cca4a80bacbf78395b2c (diff) | |
| download | coinos-server-2cc86381a6f79cd729048b34a72b70562a7b0ace.tar.gz coinos-server-2cc86381a6f79cd729048b34a72b70562a7b0ace.zip | |
Merge branch 'code_reorg'
Diffstat (limited to 'src/routes/calculator.coffee')
| -rw-r--r-- | src/routes/calculator.coffee | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/routes/calculator.coffee b/src/routes/calculator.coffee new file mode 100644 index 00000000..4f3ac0b5 --- /dev/null +++ b/src/routes/calculator.coffee @@ -0,0 +1,27 @@ +exports.sweep = (req, res) -> + res.render('calculator/sweep', + layout: 'layout', + navigation: true, + js: (-> global.js), + css: (-> global.css) + ) + +exports.ticker = (req, res) -> + fs = require('fs') + fs.readFile("./public/js/rates.json", (err, data) -> + req.query.currency ||= 'CAD' + req.query.symbol ||= 'quadrigacx' + req.query.type ||= 'bid' + + try + exchange = JSON.parse(data)[req.query.currency][req.query.symbol]['rates'][req.query.type].toString() + catch e + exchange = "0" + + res.writeHead(200, + 'Content-Length': exchange.length, + 'Content-Type': 'text/plain') + res.write(exchange) + res.end() + ) + |
