Skip to content

Commit 6c9b6bf

Browse files
committed
Merge pull request #34 from GoogleCloudPlatform/fix-mongodb
Cleaned up some indentation and logging.
2 parents 078d5f8 + 90a6ea9 commit 6c9b6bf

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ and applications on [Google App Engine](http://cloud.google.com/nodejs).
2424

2525
### Databases
2626

27-
- Redis - [Source code][redis_1] | [App Engine Tutorial][redis_2] | [Documentation][redis_3]
2827
- MongoDB - [Source code][mongo_1] | [App Engine Tutorial][mongo_2] | [Documentation][mongo_3]
28+
- Redis - [Source code][redis_1] | [App Engine Tutorial][redis_2] | [Documentation][redis_3]
2929

3030
### Tools
3131

@@ -108,14 +108,14 @@ See [LICENSE](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/ma
108108
[sails_3]: http://sails-dot-nodejs-docs-samples.appspot.com
109109
[sails_4]: http://sailsjs.org/
110110

111-
[redis_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/redis
112-
[redis_2]: https://cloud.google.com/nodejs/resources/databases/redis
113-
[redis_3]: https://redis.io/
114-
115111
[mongo_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/mongo
116112
[mongo_2]: https://cloud.google.com/nodejs/resources/databases/mongo
117113
[mongo_3]: https://docs.mongodb.org/
118114

115+
[redis_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/redis
116+
[redis_2]: https://cloud.google.com/nodejs/resources/databases/redis
117+
[redis_3]: https://redis.io/
118+
119119
[gcloud_1]: https://github.com/GoogleCloudPlatform/gcloud-node
120120
[gcloud_2]: https://googlecloudplatform.github.io/gcloud-node/#/
121121

appengine/mongo/server.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ mongodb.MongoClient.connect(uri, function(err, db) {
3838
// Create a simple little server.
3939
http.createServer(function(req, res) {
4040

41-
console.log("test");
42-
console.log(err);
43-
4441
// Track every IP that has visited this site
4542
var collection = db.collection('IPs');
4643

@@ -54,18 +51,18 @@ mongodb.MongoClient.connect(uri, function(err, db) {
5451
var iplist = '';
5552
collection.find().toArray(function(err, data) {
5653
if (err) throw err;
57-
console.log('listing data...\n');
5854
data.forEach(function(ip) {
59-
console.log('IP: ' + ip.address + '\n');
60-
iplist += ip.address + '; ';
55+
iplist += ip.address + '; ';
6156
});
6257

63-
res.writeHead(200, {
64-
'Content-Type': 'text/plain'
65-
});
66-
res.end(iplist);
58+
res
59+
.writeHead(200, {
60+
'Content-Type': 'text/plain'
61+
})
62+
.end(iplist);
6763
});
6864
})
69-
}).listen(process.env.PORT || 8080);;
70-
console.log('started web process');
65+
}).listen(process.env.PORT || 8080, function () {
66+
console.log('started web process');
67+
});
7168
});

0 commit comments

Comments
 (0)