Can't find a specific library? You can create a new one. You will find below the suggested guidelines to develop a complete library to facilitate the creation of your microservices.
Your library should make the creation of Microservices easier by providing functions and structures to take advantages of Mia-Platform features.
The library should include an HTTP client which exposes HTTP verbs (
Moreover, to easily perform CRUD operations it should also include a specific HTTP client to make relative requests, e.g:
Calling any service defined on the Platform project should be an important feature for the creation of microservices. To do this, the developer who will use your library should be able to call a route with some options.
Check out the related Mia service Node.js library documentation for an example.
The library should provide methods to declare and handle the Console decorators.
It should include methods for accessing the original HTTP request and response and change them, according to the following rules.
Check out the Mia service Node.js library decorators documentation for an example.
The library should be able to expose auto-generated documentation for each endpoint. It should exist a dedicated endpoint where show the API documentation.
Check out the Mia service Node.js library API documentation for an example.
The library should be able to generate logs in JSON format, using appropriate levels. You can follow our guidelines for logs. Coherent logging allows you to properly view logs in Log & monitoring section of Console and to use them to create custom dashboards.
Check out the Mia service Node.js logging documentation for an example.
Write clear and useful documentation is as important as to write good code. This will help who is using your library to interact with Mia-Platform easily.
This section contains specific guidelines to write the documentation of your Mia service library. We assume the documentation is integrated into the repository of the library. For a complete example, you can see Mia service Node.js library.
README file must be small and provide an overview of the library and the table of contents with links to the more detailed sections, that should be written in markdown in a separate
The documentation of libraries should answer the following questions:
- What does it do and why should I use it?
- How can I easily and rapidly start to use it?
- How can I put myself into a situation where to use the library with best practices?
- How does it interact with Mia-Platform?
A simple documentation structure to address all these questions can be the following:
- Getting started
- Set up the local development environment
- Install - How to install/include the library.
- Kickoff Example - A little example that immediately highlights the primary features of the library, explained step to step.
- Configurations - Required configuration of environment variables and other items.
- Examples - More advanced examples, with the instruction to easy launch them
- How to - Each feature is explained in detail in related
- Create your service
- Declare routes
- Add decorators
- Call the other services on the Platform project
- See API documentation