aboutsummaryrefslogtreecommitdiffstats
path: root/app.js
blob: 10219d1c550ea571f82be6d61b557e338c46c632 (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
27
28
29
30
31
32
33
34
35
36
37
38
var express = require('express')
  , http = require('http')
  , path = require('path')
  , engines = require('consolidate')
  , app = express();

app.engine('html', engines.hogan);
app.set('view engine', 'html');
app.set('views', __dirname + '/views');
app.use(express.static(path.join(__dirname, 'public')));

app.get('/', function(req, res) {
  res.render('index');
});

app.get('/report', function(req, res) {
  res.render('report');
});

app.get('/ticker', function(req, res) {
  var options = {
    host: 'bitcoincharts.com', 
    path: '/t/depthcalc.json?symbol=virtexCAD&type=bid&amount=1001&currency=true'
  }

  require('http').get(options, function(r) {
    r.setEncoding('utf-8');
    r.on('data', function(chunk) {
      res.send(chunk);
    }); 
  });
});

app.get('/:client', function(req, res) {
  res.render('calculator', { title: req.param('client') });
});

app.listen(3000);