var express = require('express'),
    app = express(),
    coffeeBear = require('./coffee-bear');

// configuration
app.set('port', process.env.PORT || 5000);

app.get('/api/v1/measurements/:cups?', function (req, res) {
  coffeeBear(function (err, data) {
    var cups = req.params.cups;

    if (err) { res.json(500, {error: err}); }

    console.log(cups);

    if (cups === undefined) {
      res.json(data);
      return;
    }

    if (data[cups] !== undefined) {
      res.json(data[cups]);
      return;
    }

    res.json(404, {error: 'Measurement not found' });
  });
});

app.listen(app.get('port'), function () {
  console.log('listening on port ' + app.get('port'));
});

@@ -334,32 +334,8 @@
  %7D%0A%0A
-    console.log(cups);%0A%0A
     

remove console log