Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 8dd9733

Browse files
committed
Clean up MongoDB server.js
1 parent d2de37d commit 8dd9733

File tree

1 file changed

+3
-4
lines changed
  • containers/javascript-node-lts-mongo/test-project

1 file changed

+3
-4
lines changed

containers/javascript-node-lts-mongo/test-project/server.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ const MONGO_URL = 'mongodb://mongo:27017';
1414
const DB_NAME = 'test-project';
1515
const HOST = '0.0.0.0';
1616

17-
(async()=> {
17+
(async () => {
1818

1919
// Use connect to mongo server
20-
const client = new MongoClient(MONGO_URL);
20+
const client = new MongoClient(MONGO_URL, { useNewUrlParser: true });
2121
await client.connect();
2222
console.log('Connected successfully to Mongo DB');
2323
const db = client.db(DB_NAME);
@@ -26,12 +26,11 @@ const HOST = '0.0.0.0';
2626
// App
2727
const app = express();
2828
app.get('/', async (req, res) => {
29-
await testHitsCollection.insertOne({date:new Date()});
29+
await testHitsCollection.insertOne({ date: new Date() });
3030
const count = await testHitsCollection.countDocuments();
3131
res.send('Hello remote world! ' + count + ' test records found.');
3232
});
3333

3434
app.listen(PORT, HOST);
3535
console.log(`Running on http://${HOST}:${PORT}`);
3636
})();
37-

0 commit comments

Comments
 (0)