Testing APIs manually
That concludes the implementation of our microservices. Let’s try them out by performing the following steps:
- Build and start the microservices as background processes.
- Use
curl
to call the composite API. - Stop the microservices.
First, build and start up each microservice as a background process, as follows:
cd $BOOK_HOME/Chapter03/2-basic-rest-services/
./gradlew build
Once the build completes, we can launch our microservices as background processes to the Terminal process with the following code:
java -jar microservices/product-composite-service/build/libs/*.jar &
java -jar microservices/product-service/build/libs/*.jar &
java -jar microservices/recommendation-service/build/libs/*.jar &
java -jar microservices/review-service/build/libs/*.jar &
A lot of log messages will be written to the Terminal, but after a few seconds, things will calm down and we will find the following messages written...