Standardizing service boilerplate
As a system grows, any hard coded will cause inflexibility and friction and tend to drag on development, maintenance, and operations.
Additionally, introducing a standard data format for communication between services means we avoid having to create specific (and likely, brittle) API contracts between services.
We recommend keeping service logic (which often represents business logic) separate from implementation logic. This allows us to switch out the implementation piece, without disrupting the business logic or service logic portion.
In this recipe, we are going to improve the internal structure of our adderservice
, decoupling service logic from restify
framework housing. We're going to remove hard coded URLs and port numbers while switching to using JSON as the transmission format between services.
Our adderservice
will then become the canonical template for any other services that we may create for our system in proceeding recipes.
Getting ready
This recipe...