Search code examples
node.jsexpressmicroservicesexpress-gateway

Return response according to a common json schema


How can I make standard json keys schema for multiple API service.

What if on original response I want to map to specific keys? Maybe adding or removing keys too?

I'd like to have same json keys output for all api services for example: api service output:

{ "hello" : "word" }

but i want to response:

{"foo" : originalResponse.hello }

Thanks


Solution

  • I do not understand why the downvotes, the question seems legit to me.

    In any case, you can achieve the use case by using the body modifier plugin we offer. Although it's not an official one, it should provide all you need to both add are move keys on a JSON payload based on any Javascript evaluable expression.

    Cheers!