Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions Bikes/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ var async = require('async');

// var mongoDBCollection = process.env.mongo_collection;
var mongoDBCollection = "bikes";
// var mongoDBConnStr = "mongodb://databases-mongo";
var mongoDBConnStr = "mongodb://" + process.env.mongo_connectionstring + ":" + process.env.mongo_port;
var mongoDBConnStr = "mongodb://databases-mongo";
if (process.env.mongo_port) {
mongoDBConnStr = "mongodb://" + process.env.mongo_connectionstring + ":" + process.env.mongo_port;
}

console.log("Collection: " + mongoDBCollection);
console.log("MongoDB connection string: " + mongoDBConnStr);
Expand Down Expand Up @@ -242,10 +244,10 @@ app.get('/api/bikes/:bikeId', function(req, res) {
theBike.id = theBike._id;
delete theBike._id;

// if (req.query["unitType"] == "imperial") {
// theBike.suitableHeightInMeters = theBike.suitableHeightInMeters * 300; // 3.28084;
// theBike.maximumWeightInKg = theBike.maximumWeightInKg * 300; // 2.204623;
// }
if (req.query["unitType"] == "imperial") {
theBike.suitableHeightInMeters = theBike.suitableHeightInMeters * 3.28084;
theBike.maximumWeightInKg = theBike.maximumWeightInKg * 2.204623;
}

res.send(theBike);
});
Expand Down
2 changes: 0 additions & 2 deletions Bikes/service.env

This file was deleted.