I’m attempting to send a POST request to a Netlify website through a React Native app. The details of the request aren’t important, as it simply sends an email with the provided data.
The issue is that this works flawlessly on localhost. I have my site running on a development server locally, and the POST request goes through with ease. However, when I push the same code to Netlify, I get no response from the POST request. This is difficult to debug, as there are no error messages I can turn to.
Ok, so, the only function that would get created is /functions/server.js and that would end up at the endpoint https://www.livesantaclaus.com/.netlify/functions/server.
Unless you plan to proxy rewrite the function to /api/email, that endpoint does not exist.
I see. So can I use that URL for the request, or how would that work?
In server.js, I have an app.post(’/api/email’)… function that accepts a post request. Would I append “api/email” to the URL you provided or do I simply send the request to that URL?
Alternatively, is using Netlify functions slightly redundant in this instance? Is there an easier way to setup API endpoints on Netlify?