reaction icon indicating copy to clipboard operation
reaction copied to clipboard

Reinstate ability to register an endpoint

Open brent-hoover opened this issue 4 years ago • 5 comments

At one point it was possible to register an endpoint (route) to handle incoming requests. One common usage for this is to register a callback URL for payment systems like Paypal that use a token. Another would be when creating webhooks. It's possible this capability exists and I have not been able to find it but I believe it was removed during DeMeteorization.

brent-hoover avatar Jan 03 '22 23:01 brent-hoover

@zenweasel This is still available and for example in use here:

https://github.com/reactioncommerce/api-plugin-sitemap-generator/blob/88c9e71d62c096ab182bf7a101ff4bae315d7e44/src/startup.js#L19

However, similar to the considerations in https://github.com/reactioncommerce/reaction/issues/6279 defining these routes during runtime, while very flexible, is not optimal for a more distributed architecture - I would favor having them defined as part of the plug-in registration.

janus-reith avatar Jan 04 '22 08:01 janus-reith

Thanks for the info @janus-reith but it's not quite what I am talking about as that is just utilizing the underlying express app. (also a legitimate thing to do)

At one point you could actually register an endpoint via plugin registration like here so that's more what I was talking about

brent-hoover avatar Jan 04 '22 11:01 brent-hoover

Thanks for the info @janus-reith but it's not quite what I am talking about as that is just utilizing the underlying express app. (also a legitimate thing to do)

At one point you could actually register an endpoint via plugin registration like here so that's more what I was talking about

@zenweasel link goes to 404 error, I really need the example=)

OlehObodin avatar May 26 '22 16:05 OlehObodin

@zenweasel This is still available and for example in use here:

https://github.com/reactioncommerce/api-plugin-sitemap-generator/blob/88c9e71d62c096ab182bf7a101ff4bae315d7e44/src/startup.js#L19

However, similar to the considerations in #6279 defining these routes during runtime, while very flexible, is not optimal for a more distributed architecture - I would favor having them defined as part of the plug-in registration.

@janus-reith This one works, thanks.

OlehObodin avatar May 27 '22 10:05 OlehObodin