Route handler or Server action?
Unanswered
Pacific anchoveta posted this in #help-forum
Pacific anchovetaOP
Hi, guys, I hope you don't mind me asking a possibly stupid question - I'm basically in the dark when it comes to server actions (and tbh back-end/server related things in general).
I'm currently trying to find the optimal/best practice/most secure way of handling a call to a third party API (BTCPayServer's Greenfield API: https://docs.btcpayserver.org/Development/GreenFieldExample-NodeJS/).
What I want is to do a POST request to this api, and I need to send an amount: number along with an acces token in the header
This (i think) should be triggered upon an onClick event on a <button> in a client component.
Should I go for the app/api/createInvoice/route.ts approach, or would you go for a "server action" in this case?
I'm currently trying to find the optimal/best practice/most secure way of handling a call to a third party API (BTCPayServer's Greenfield API: https://docs.btcpayserver.org/Development/GreenFieldExample-NodeJS/).
What I want is to do a POST request to this api, and I need to send an amount: number along with an acces token in the header
Authorization: token ${btcPayServerApiKey}.This (i think) should be triggered upon an onClick event on a <button> in a client component.
Should I go for the app/api/createInvoice/route.ts approach, or would you go for a "server action" in this case?