Tuesday, 18 February 2020

serviser now open source - REST APIs - solving common problem with almost any nodejs framework out there

serviser came to a live during few past years at Bohemia Interactive where I needed to solve repeating issues that we had when making micro service based REST APIs.Main issues that we kept on experiencing included:- Application reliabilityIdeally, it should never happen that node process crashes due to unhandled exception. Or that a service starts with failing connection to eg. database or unreachable another dependent service without at least notifying the team.Inconsistent and tedious error handling in request lifecycle across services made it unnecessarily hard to standardize APIs across teams.​- ValidationI think validating input data (and filtering output data) is important enough in request lifecycle that it should be powerful enough feature and integral part of any framework, preferably without much boilerplate code.Solution: framework is using json-schema (ajv library) to define input and output data structures.​- Documentation, Documentation and Documentation:It gets quickly frustrating when using undocumented software or worse, API that's behaving different to what is in documentation.When developing in very small team, documenting should not be that big of an issue with at least a little of discipline. However if you have multiple teams working on many microservices in parallel, documentation tends to get out of sync really fast and it happens because its boring to repeat yourself writing documentation when you just finished implementing an endpoint where you already everything described at least once.Solution: Very detailed documentation for consumers gets generated straight from the code implementation, not from comments or manually written markdown. This makes the documentation to always reflect the current implementation without requiring any extra manual labor.​- Communication between services:That was not that big of an issue relatively to other stuff but still something that could be and was made more convenient by allowing to generate client API SDKs in form of npm package by single cli command.​What experience you have when developing scalable API services? Have you encountered similar issues or different?

Submitted February 18, 2020 at 11:50PM by fogine

No comments:

Post a Comment