Adding a 2nd Service and Connect with the 1st One
Create a new service
Now that our main service is up and running, let's create another service with which the client will interact. It will have some business data, some validations and call the previous service.
We will start by checking out another branch created by a new ticket for the new service, continue to create the API, and generate the skeleton code.
Adding the business logic on the code side
The new endpoint is now ready for some flow and business logic. We will start with writing the flow in the application, continue with adding some business logic in the domain, and spin this new service.
Testing the entire flow
We will create a few tests to check some usecases, run them and check that the requests work, and that the numbers match according to the business request.
Note ! This step is usually performed prior to the previous step, by QA/TDD team. In this tutorial we added it after the business logic was created for simplicity.
If business requirements change, the usecases will update, the developer will run the tests, see they don’t work, and fix.