Phase 4 – Porting main

Now you can port the main part of the service. You should delegate all the details to the packages, but the main program should spell out the control-flow in the program. For example, in a REST API service, the main would define the main router, a health check endpoint, and various router groups (like in Gin) for each resource, where each resource is inside its own package. Now, finally, you should be able to run your service.

This is also the time to write tests. Since most of the packages are mocked, it is expected that many tests will fail. This is the central tenet of test-driven developmentwrite tests first and then code till the tests start passing.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset