
Extending your API gateway without forking it
Most API gateways are extensible in theory. In practice, you end up reading source code for hours before writing a single line of business logic. I ran into this while building Kono. Before deciding on the plugin architecture, I looked at how KrakenD handles request/response modification. Their approach is powerful but has real entry cost: you implement a ModifierRegisterer symbol, call RegisterModifiers with factory functions, copy-paste RequestWrapper and ResponseWrapper interface definitions into your plugin (they use interface{} to avoid dependency collisions), and wire everything through extra_config in JSON. The minimal boilerplate is around 60 lines before you write any logic. Here's what that looks like just to register a modifier in KrakenD: var ModifierRegisterer = registerer ( "my-plugin" ) func ( r registerer ) RegisterModifiers ( f func ( name string , factoryFunc func ( map [ string ] interface {}) func ( interface {}) ( interface {}, error ), appliesToRequest bool , appl
Continue reading on Dev.to
Opens in a new tab



