From 90a6ea974c927043846baef6e490cb1f42f7c376 Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Thu, 19 Nov 2015 10:10:28 -0800 Subject: [PATCH] Cleaned up some indentation and logging. --- README.md | 10 +++++----- appengine/mongo/server.js | 21 +++++++++------------ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 9cb203d4d8..208351462c 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ and applications on [Google App Engine](http://cloud.google.com/nodejs). ### Databases -- Redis - [Source code][redis_1] | [App Engine Tutorial][redis_2] | [Documentation][redis_3] - MongoDB - [Source code][mongo_1] | [App Engine Tutorial][mongo_2] | [Documentation][mongo_3] +- Redis - [Source code][redis_1] | [App Engine Tutorial][redis_2] | [Documentation][redis_3] ### Tools @@ -108,14 +108,14 @@ See [LICENSE](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/ma [sails_3]: http://sails-dot-nodejs-docs-samples.appspot.com [sails_4]: http://sailsjs.org/ -[redis_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/redis -[redis_2]: https://cloud.google.com/nodejs/resources/databases/redis -[redis_3]: https://redis.io/ - [mongo_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/mongo [mongo_2]: https://cloud.google.com/nodejs/resources/databases/mongo [mongo_3]: https://docs.mongodb.org/ +[redis_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/redis +[redis_2]: https://cloud.google.com/nodejs/resources/databases/redis +[redis_3]: https://redis.io/ + [gcloud_1]: https://github.com/GoogleCloudPlatform/gcloud-node [gcloud_2]: https://googlecloudplatform.github.io/gcloud-node/#/ diff --git a/appengine/mongo/server.js b/appengine/mongo/server.js index 052f3cad25..85ae124d9e 100644 --- a/appengine/mongo/server.js +++ b/appengine/mongo/server.js @@ -38,9 +38,6 @@ mongodb.MongoClient.connect(uri, function(err, db) { // Create a simple little server. http.createServer(function(req, res) { - console.log("test"); - console.log(err); - // Track every IP that has visited this site var collection = db.collection('IPs'); @@ -54,18 +51,18 @@ mongodb.MongoClient.connect(uri, function(err, db) { var iplist = ''; collection.find().toArray(function(err, data) { if (err) throw err; - console.log('listing data...\n'); data.forEach(function(ip) { - console.log('IP: ' + ip.address + '\n'); - iplist += ip.address + '; '; + iplist += ip.address + '; '; }); - res.writeHead(200, { - 'Content-Type': 'text/plain' - }); - res.end(iplist); + res + .writeHead(200, { + 'Content-Type': 'text/plain' + }) + .end(iplist); }); }) - }).listen(process.env.PORT || 8080);; - console.log('started web process'); + }).listen(process.env.PORT || 8080, function () { + console.log('started web process'); + }); });