Skip to content

Commit 7782863

Browse files
committed
Update MongoDB sample to not query database for health check.
1 parent 8cfdf67 commit 7782863

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

appengine/mongodb/server.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ let uri = `mongodb://${user}:${pass}@${host}:${port}`;
3737
if (nconf.get('mongoDatabase')) {
3838
uri = `${uri}/${nconf.get('mongoDatabase')}`;
3939
}
40+
console.log(uri);
4041

4142
mongodb.MongoClient.connect(uri, (err, db) => {
4243
if (err) {
@@ -45,6 +46,14 @@ mongodb.MongoClient.connect(uri, (err, db) => {
4546

4647
// Create a simple little server.
4748
http.createServer((req, res) => {
49+
if (req.url === '/_ah/health') {
50+
res.writeHead(200, {
51+
'Content-Type': 'text/plain'
52+
});
53+
res.write('OK');
54+
res.end();
55+
return;
56+
}
4857
// Track every IP that has visited this site
4958
const collection = db.collection('IPs');
5059

0 commit comments

Comments
 (0)