Node.js Backend and API Developer Needed

Job ID: 38079946

Budget: $8 – $15 USD

Description

I have a small Node/Docker application which does not work if the MongoDB library is included. Structure of the application is:

Node Express application - Exposes a few simple test API endpoints.

Docker - The Node application runs in a Docker container

MongoDB Atlas - Currently this is *not* included but it is the objective of this work. I want the Node application to make a connection to MongoDB using the *native Mongo* driver. NOT Mongoose.

NodeMon - Project is setup with file monitoring to save development time. Also, the Visual Studio debugger is enabled and appears to be working well.

Here is a link to a Visual Studio project which contains a test version of the application error. It has had files removed for security and to reduce the file size. Here’s some rough instructions, I’m not a Node/Docker expert but this should get you going. https://file.io/R3jL5LZhTzPp

1 - Download and uncompressed the Visual Studio zip file
2 - Open the workspace in Visual Studio
3 - Open a new terminal window in the project root folder and run "docker compose build" to the project
4 - Run ‘docker compose up’ to run the project

You’re objective is to:

1 - Remove the "//const MongoClient = require("mongodb").MongoClient;” line
2 - Run ‘docker compose up’ to start the code
3 - Fix the code so it does not crash
4 - Demonstrate a working connection between the application and a remote Mongo Atlas database (you will need to create one yourself or point to one). The data does not matter, I just need to see examples of: a) A READ query, b) An UPDATE query, c) A CREATE new record query




Error

See this file for a description of the error which needs to be fixed - https://monosnap.com/file/Cb7mNmmBKVBYe1hhb1RWW3iwmq3WhE


Debugging

The application connects to a remote Mongo Atlas database correctly if the code is run outside the container. I’ve developed a simple Mongo connection js file which tests this. The output is shown here - https://monosnap.com/file/RQVD4eOLd7ME1jVssEAff2y2HvVykQ

Also, here is a screenshot of a sample GET call to the API endpoint using Postman. This call works when the Mongo library is commented out in the vehicle.js file. https://monosnap.com/file/WpKAU3xydiJvFgUFHnkfvCwKTTCjBp

I’ve also checked the Mongo library is present within the running Docker container. This has been done by looking at the file system of the Node app within Docker Desktop. https://monosnap.com/file/ozU4qdScau4sNnV5mssMWpDv2LlfEb

NOTE - I have deleted the node_modules folder to reduce the size of the sample application for upload. The Docker compose process should rebuild this.


Deliverables

A working Visual Studio project which allows the Node application to connect with a remote Atlas hosted Mongo database. Importantly, the Node application must be hosted in a Docker container.


Timescale

I expect this should be a very simple task for an experienced Node/Docker/Mongo developer. Including time for Q&A and setup I’m thinking this is no more than a couple of hours work. If you disagree please do not waste time responding.


Skills Needed

You will have strong experience in Node/Express, Docker, Mongo, NodeMon. You will be self sufficient and able to work without extensive supervision. Good communication and English skills are essential.
Related categories: Node.js Docker MongoDB Visual Studio Docker Compose