jkyberneees / fastify-gateway

A Node.js API gateway that just works!
https://www.npmjs.com/package/k-fastify-gateway
MIT License
107 stars 14 forks source link

what is shouldAbortProxy in the proxy function ? #28

Closed x-077 closed 5 years ago

x-077 commented 5 years ago

Hello,

what is the purpose of 'shouldAbortProxy' in :

https://github.com/jkyberneees/fastify-gateway/blob/master/index.js#L6-L8 ?

Thanks

jkyberneees commented 5 years ago

hi @matth-c3, as described:

async onRequest (req, reply) {
      //   // we can optionally reply from here if required
      //   reply.send('Hello World!')
      //
      //   return true // truthy value returned will abort the request forwarding
},

The shouldAbortProxy holds the result of the onRequest hook execution, it allows developers to completely abort the request forwarding at gateway level.

Use cases: