blob: 0ca7eee6079098ab134eb405aa240e58e3283b5d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
exports.new = (req, res) ->
res.render('calculator/setup', js: (-> global.js), css: (-> global.css))
exports.show = (req, res) ->
res.render('calculator/show',
js: (-> global.js),
css: (-> global.css),
)
exports.ticker = (req, res) ->
options =
host: 'api.bitcoinaverage.com',
path: "/exchanges/CAD"
require('http').get(options, (r) ->
r.setEncoding('utf-8')
r.on('data', (chunk) ->
exchange = JSON.parse(chunk).cavirtex.rates[req.query.type].toString()
res.writeHead(200,
'Content-Length': exchange.length,
'Content-Type': 'text/plain')
res.write(exchange)
res.end()
)
)
|