Skip to content

Latest commit

 

History

History
45 lines (36 loc) · 3.03 KB

README.md

File metadata and controls

45 lines (36 loc) · 3.03 KB

MicroObs API Gateway

Language: JavaScript License: MIT

An API Gateway corresponds to the entry point of a microsservice application. In the MicroObs project, it is used to provide an interface for the observalibity aspects currently supported (logs and metrics). According to Richardson(2019), an API gateway may implement the following functionalities (including the usual routing/composition):

  • Routing / composition ✔️
  • Authentication / authorization ✔️
  • Request logging ✔️
  • Caching ✔️
  • Rate limiting
  • Metrics collection

By now, the microobs API gateway supports the checked concerns.

This module has been developed using the Node.js platform together with the flexible Express framework. Trying to bring a different, preferably more flexible, approach, the gateway supports not only the usual REST communication mechanism (a common pattern adopted by various microservices implementations), but also the GraphQL query language. GraphQL brings a distinct approach by letting the consumers query exactly what they want, thus avoiding underfetching and overfetching. A valuable discussion can be found here.

Usage

Right now, the the gateway image must be manually built. That can be accomplished by running the following commands:

# clone the gateway repository
git clone https://github.com/microobs/gateway
cd gateway

# build the image
# api_gateway is the tag configured to be used in the microobs docker-compose
sudo docker build -t api_gateway .

After that, it can be run together with the other services of the MicroObs project by running docker-compose up -d (more details on the MicroObs main page). The gateway listens at Port 8081.

Documentation

The complete documentation can be found under the /docs folder.

Future Improvements

  • Continue enhancing the endpoints
  • Add other promising technologies like gRPC
  • Improve the auth logic to support database consumption
  • Address the other functionalaties not covered yet like rate limiting
  • Evaluate the incorporation of the circuit breaker pattern

Contribution

This module along with the MicroObs project helped the creation of the open source JS module Prom-GraphQL that as long as we know it's the first GraphQL wrapper on the Prometheus REST API.

License

MicroObs API Gateway is available under the MIT license. See the LICENSE file for more info.