DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Action Protocol, abstract layer to help create your microservice.
Julio Contreras
Julio Contreras

Posted on

Action Protocol, abstract layer to help create your microservice.

Hello world! I've been a programmer for over ten years in different technologies.

This year I started making my own microservices and found many interesting things like DDD architecture, gRPC protocols and metrics systems.

In the middle of development I came across a question. How use HTTP or gRPC without change my application?

It was when I had the idea to create an abstraction layer, where I pass the action, data and authorization token.

This also allows to control the time and quantity of general requests or by type of action.

Image description

Example data:

{
  "action": "createCar",
  "data": {
    "brand": "Ferrary",
    "color": "red"
  },
  "token": "mytokensecret" 
}
Enter fullscreen mode Exit fullscreen mode

Repository:
https://www.npmjs.com/package/action-grpc

Example project using action-grpc:

  • src/infrastructure/http/http.ts
  • src/infrastructure/grpc/grpc.ts

https://github.com/julioacontreras/authenticator-storage

ThankΒ΄s and good vibes!
Bye

Top comments (0)

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›