Creating a POST Request to an External API with Next.js
Last updated: Sep 24, 2022
Hello there. I have successfully extended the built-in actions of my docs to create a POST request to an external API. I am wondering if there is any risk to this method? I am using Next.js and could redirect to one of my API routes and handle the POST to external API there.
Sep 24, 2022, 1:37 AM
I would recommend your suggestion as well, because this would mean the POST is made from a server and not from the browser. This means you can safely secure API keys on your lambda without having to bundle them in the Sanity client-side studio.