Overview:
Node.js with MongoDB and Docker DemoApplication is a demonstration designed to showcase the integration and functionality of using Node.js and MongoDB within Docker containers. The application utilizes Mongoose to establish a basic database for storing Docker commands and examples.
Features:
- Docker Integration: Demonstrates how Node.js and MongoDB can be run in Docker containers.
- Mongoose Database: Utilizes Mongoose to create and manage a simple database for storing Docker commands and examples.
- Easy Installation: Provides straightforward steps for starting the application using Docker containers or without Docker.
Installation:
Starting the Application with Docker Containers:
- Install Docker Desktop.
- Open a command prompt.
- Run the commands listed in node.dockerfile.
- Navigate to http://localhost:3000.
Starting the Application with Docker Compose:
- Install Docker Desktop.
- Open a command prompt at the root of the application’s folder.
- Run
docker compose build. - Run
docker compose up. - Open another command prompt and run
docker compose ps -ato note the ID of the Node container. - Run
docker exec -it <nodeContainerID> shto shell into the container. - Run
node dbSeeder.jsto seed the MongoDB database. - Navigate to http://localhost:3000 in your browser.
Running the App with Node.js and MongoDB (without Docker):
- Install and start MongoDB.
- Install the LTS version of Node.js.
- Adjust the host name in
config/config.development.jsonto your MongoDB server name. - Run
npm install. - Run
node dbSeeder.jsto load sample data into MongoDB. - Run
npm start. - Navigate to http://localhost:3000 in your browser.
Summary:
The Node.js with MongoDB and Docker DemoApplication is a comprehensive demo illustrating the seamless integration of Node.js and MongoDB within Docker containers. By following the provided installation steps, users can experience the application’s functionality with or without Docker, making it a versatile tool for learning and development purposes.