-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
executable file
·59 lines (49 loc) · 1.46 KB
/
server.js
File metadata and controls
executable file
·59 lines (49 loc) · 1.46 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use strict';
/**
* Module dependencies.
*/
var init = require('./config/init')(),
config = require('./config/config'),
mongoose = require('mongoose'),
chalk = require('chalk');
/**
* Main application entry file.
* Please note that the order of loading is important.
*/
// Bootstrap db connection
var db = mongoose.connect(config.db, function(err) {
if (err) {
console.error(chalk.red('Could not connect to MongoDB!'));
console.log(chalk.red(err));
}
});
// Init the express application
var app = require('./config/express')(db);
// Bootstrap passport config
require('./config/passport')();
// Start the app by listening on <port>
app.listen(config.port);
// Expose app
exports = module.exports = app;
// Logging initialization
console.log('MEAN.JS application started on port ' + config.port);
var Uber = require('node-uber');
var ubercost=0;
var uber = new Uber({
client_id: 'WqZA5bBnlVOwj5H9A2ondWI3_oa8QMXm',
client_secret: 'RuooXCT9q1iB53o3HWdlJE3XNuY22u1WqOZlhhjR',
server_token: 'Y2gCLsgqQB7nyMjduRt1jspsfepAVrU_ibpgr7uh',
redirect_uri: 'http://localhost:3000/#!/',
name: 'CoDrinks'
});
uber.estimates.price({
start_latitude: 39.950123, start_longitude: -74.8109725,
end_latitude: 39.9012015, end_longitude: -75.1719795
}, function (err, res) {
if (err) console.error(err);
else{ console.log(res);
console.log(1);
console.log("The Uber cost is: " + res.prices[0].high_estimate);
ubercost=res.prices[0].high_estimate;
};
});