https://github.com/km-saifullah/hello-app
This is a repository to practice docker compose with a simple express app with mongoDB
https://github.com/km-saifullah/hello-app
docker docker-compose express mongodb
Last synced: 3 months ago
JSON representation
This is a repository to practice docker compose with a simple express app with mongoDB
- Host: GitHub
- URL: https://github.com/km-saifullah/hello-app
- Owner: km-saifullah
- Created: 2025-05-18T13:58:30.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-18T15:00:06.000Z (about 1 year ago)
- Last Synced: 2025-05-18T15:32:06.615Z (about 1 year ago)
- Topics: docker, docker-compose, express, mongodb
- Language: JavaScript
- Homepage:
- Size: 3.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hello Express App with MongoDB (Dockerized) π₯
A simple Express.js application using MongoDB, fully containerized with Docker and Docker Compose. This project demonstrates how to use Mongoose to store and update data inside a MongoDB container.
## π¦ Features
- Express.js server (ES Modules)
- MongoDB (running in a separate Docker container)
- One route `/api/v1/welcome` to:
- Store message `"hello universe"`
- Increment a counter each time itβs accessed
- Fully containerized using Docker Compose
## π οΈ Prerequisites
- [Docker](https://www.docker.com/)
- [Docker Compose](https://docs.docker.com/compose/)
## βοΈ Build and run containers
**Step-1:** Clone the Repository
```bash
git clone https://github.com/km-saifullah/hello-app.git
```
**Step-2:** Build and runs containers
```bash
docker-compose up --build
```
**Note**: This builds and runs both the express-app and mongo-db containers
**Step-3:** View Logs
```bash
docker-compose logs app
docker-compose logs mongo
```
**Step-4:** Stop and remove containers
```bash
docker-compose down
```
**Note**: When we want to stop the containers we need to run the above commnad only.
## π₯ API Endpoints
1. Root route: http://localhost:8000/
2. Welcome Message Route: http://localhost:8000/api/v1/welcome
## π Test
```bash
curl http://localhost:8000/api/v1/welcome
```
## πββοΈ Author
Khaled Md Saifullah
Backend Developer
Follow me on:
- [Linkedin](https://www.linkedin.com/in/kmsaifullah)
- [Github](https://github.com/km-saifullah)