Company
Date Published
Author
Jens Neuse
Word count
1852
Language
English
Hacker News points
2

Summary

We've developed Cosmo Router, an open-source GraphQL API Gateway that routes requests from clients to Subgraphs, implementing the GraphQL Federation contract. To provide a flexible configuration system for our users, we decided to use an expression language called Expr Lang. This decision was driven by the need to allow users to customize the behavior of the Router without modifying the source code. Expr Lang is designed to deliver dynamic configurations with unparalleled accuracy, safety, and speed. It combines simple syntax with powerful features for ease of use. The key benefits of using Expr Lang include its safety and side effect-free nature, ability to prevent infinite loops, fast compilation and execution, and reusability. We've implemented the expression language in our Router, allowing users to write custom expressions that can access request information and make decisions based on it. This approach provides a flexible configuration system without requiring users to modify the source code, making it easier for them to customize the behavior of the Router.