Skip to content

Commit

Permalink
Made jshint happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry committed Nov 19, 2015
1 parent 6c9b6bf commit dbf46d0
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions appengine/mongo/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,30 @@ var uri = 'mongodb://' +

mongodb.MongoClient.connect(uri, function(err, db) {

if (err) throw err;
if (err) {
throw err;
}

// Create a simple little server.
http.createServer(function(req, res) {

// Track every IP that has visited this site
var collection = db.collection('IPs');

var ip = {"address": req.connection.remoteAddress};
var ip = { address: req.connection.remoteAddress };

collection.insert(ip, function(err, result) {
collection.insert(ip, function(err) {

if (err) throw err;
if (err) {
throw err;
}

// push out a range
var iplist = '';
collection.find().toArray(function(err, data) {
if (err) throw err;
if (err) {
throw err;
}
data.forEach(function(ip) {
iplist += ip.address + '; ';
});
Expand All @@ -61,7 +67,7 @@ mongodb.MongoClient.connect(uri, function(err, db) {
})
.end(iplist);
});
})
});
}).listen(process.env.PORT || 8080, function () {
console.log('started web process');
});
Expand Down

0 comments on commit dbf46d0

Please sign in to comment.