This repository contains the implementation of a microservice architecture using KrakenD as the API gateway and a mock REST API as the backend service. The architecture is containerized using Docker, allowing for easy deployment and management.
- Docker: Ensure that Docker is installed on your local machine before proceeding with the setup.
Follow the steps below to set up and run the microservice architecture:
-
Clone the repository:
git clone [https://github.com/xen-HendryZheng/MicroService-In-10Minutes-With-Krakend-Restapi-placeholder](https://github.com/xen-HendryZheng/MicroService-In-10Minutes-With-Krakend-Restapi-placeholder)
-
Navigate to the project directory:
cd MicroService-In-10Minutes-With-Krakend-Restapi-placeholder
-
Build the Docker image:
docker build -t my-krakend-service .
-
Start the Docker container:
docker run -p 8080:8080 my-krakend-service
The KrakenD API gateway and the mock REST API backend will now be up and running.
-
Test the microservice:
Open your web browser or use tools like cURL or Postman to send a GET request to
http://localhost:8080/items
. You should receive a response containing the mock user data from thehttps://api.restapi-placeholder.com
API. More information for the mock backend service can be found at https://restapi-placeholder.com/
The configuration for the KrakenD API gateway is defined in the krakend.json
file. The current configuration uses https://api.restapi-placeholder.com
as the mock REST API backend for the /users
endpoint. Modify the krakend.json
file to customize the endpoints and backend services as per your requirements.
Dockerfile
: Contains the instructions for building the Docker image.krakend.json
: Defines the configuration for the KrakenD API gateway.- Other project files...
Contributions to this repository are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
Feel free to modify the content according to your specific repository details and add any additional sections or information as needed.