- A Node.js service (runs on port 5000)
- A Spring Boot service (runs on port 8080)
Node.js Microservice (Port 5000)
This lightweight Node.js application is packaged in Docker and listens on port 5000. It offers a single endpoint: GET /plusone/- Function: Takes an integer and returns its value plus one.
-
Example Request:
Ensure Docker is running and the container is listening on port 5000 before invoking this endpoint.
Spring Boot Microservice (Port 8080)
The Spring Boot application exposes three REST endpoints on port 8080. It illustrates service-to-service calls and conditional logic.| Endpoint | Description | Example |
|---|---|---|
| GET / | Returns a welcome message | curl http://localhost:8080/ |
| GET /increment/ | Forwards {number} to Node.js /plusone endpoint and returns the incremented result | curl http://localhost:8080/increment/41 → 42 |
| GET /compare/ | Compares {number} against 50 and returns a descriptive message | curl http://localhost:8080/compare/77 → "77 is greater than 50" |
1. GET /
Returns a simple greeting from the Spring Boot service:2. GET /increment/
This endpoint demonstrates inter-service communication. It sends the provided number to the Node.js/plusone service and returns the incremented result.
3. GET /compare/
Performs a conditional check on the input number:- If
number≤ 50: returns"{number} is less than or equal to 50". - If
number> 50: returns"{number} is greater than 50".
Port conflicts can occur if other services use ports 5000 or 8080. Always verify available ports before starting the containers.
Course Roadmap
Throughout this course, you will:- Containerize and Dockerize the Spring Boot application.
- Deploy Spring Boot securely on Kubernetes with best practices.
- Leverage an existing Docker image for the Node.js service.
- Explore service-to-service REST communication and error handling.