Code Accelerators: Microservices - NodeJS
This initiative aims to expedite the development of applications in their initial stages by providing project templates in various programming languages. These templates will adhere to a hexagonal architecture, enabling efficient and straightforward implementation and customization. This architectural approach promotes greater modularity and maintainability, adhering to best software development practices.
The main purpose of this project is to establish a microservices standard by providing a robust base code that addresses the fundamental needs of any microservices-focused project. It aims to promote good development practices, the adoption of design patterns and architecture specific to microservices. Additionally, there is an intention to encourage the implementation of rigorous processes for code testing and quality assurance, ensuring the reliability and efficiency of the resulting system.
A cross cutting concern is functionality that is apply horizontally across an entire application. This functionality play and essential role in ensuring maintainability and scalability for the system. To know more about check this link: Cross-Cutting Concerns
This application use some cross-cutting concerns, like:
- Security:
- REST APIs must be secured by requiring an Access Token
- Implementation:
- The application includes the use of a Bearer Token for the paths of the application and the use of JWT as the creation of the token.
- To create the token you can use the path
http://localhost:3001/auth/token)
- Implementation:
- Logging:
- This enabled the examination of application behavior, such as monitoring, debugging, or tracking activities within the app.
- Implementation:
- The application use a logger middleware to print in console information during the execution of the app.
- Implementation:
- Health check:
- A url that a monitoring service can “ping” to determine the health of the application
- Implementation:
- The application includes a path
http://localhost:3001/health)
to verify the health of the service
- The application includes a path
- Implementation:
- Externalized configuration:
- The application use a configuration to be connected to a Postgresql database using docker.
A Microservice API based on the hexagonal architecture using NodeJS + ExpressJS
- Source control: Trunk Based
- Commit conventions
npm install
cp .env.example .env
npm run start
Use the following commands to run the app
docker build . -t ca-microservices-nodejs
Then:
docker-compose up -d
Now you can do a HTTP request to:
http://localhost:3001/users/123123123
npm run test
- liliana.fernandez@wizeline.com - Product Owner
- diego.lozano@wizeline.com - Product Owner
- jose.pereira@wizeline.com - Technical Lead
- daniel.flores@wizeline.com - Software Engineer