<repo_name>kimheffy/uber_data_scrap<file_sep>/server.js
var express = require('express');
var app = express();
var api = require('./api');

// Serve static files
app.use(express.static('./public'))

// Mounting routes on package
app.use('/api', api);

app.listen(process.env.PORT || 3000, function(){
    console.log('Server is listening on port', process.env.PORT || 3000);
});
<file_sep>/api.js
var router = require('express').Router();
var request = require('request');
var uberApiUrl = 'https://sandbox-api.uber.com/v1/';
var uberServerToken = process.env.UBER_SERVER_TOKEN;

router.get('/estimates/price', function(req, res){
    var source = JSON.parse(req.query.source);
    var destination = JSON.parse(req.query.destination);

    // create an http request to uber api
    request.get({
        url : uberApiUrl + 'estimates/price',
        qs : {
            server_token : uberServerToken,
            start_latitude : source.lat,
            start_longitude: source.lng,
            end_latitude : destination.lat,
            end_longitude : destination.lng
        }
    }, function(err, response, body){
        if(err){
            return res.json(err);
        }
        res.json(body);
    });
});

module.exports = router;
<file_sep>/public/js/models/price.js
'use strict';

// Data coming in from API

var Price = Backbone.Model.extend({});
var Prices = Backbone.Collection.extend({
    model : Price
});
