How can I post my data collected on a form to netlify Serverless functions and then send onto a external API

How can I POST my data collected on a form to Netlify Serverless functions and then send onto a external API.

I am doing this to get around a number of CORS errors whilst i am trying to POST my data to the External API i have no control over.

I have set up a serverless function which holds data and i can show it on the front end. But I want to do the reverse, POST my data from my site and store it in Neflity and then POST this data to my external endpoint.

I’m not entirely sure what you’re describing in regards to what you have so far.

But the basic premise is:

  1. Have a form with inputs on your site
  2. Have front-end code that gets the form input values and submits them (via fetch for example) to your serverless function
  3. Have your serverless function catch those values from the request
  4. Have your sereverless function do whatever it needs to do
  5. Have your serverless function respond to the front-end request
1 Like

Hi Nathan,
So far i have numbers 1 and 2.
3 - 4 is what I am looking to build.

@Olly-p Netlify have lots of resources for learning to work with Serverless Functions.

In your case if you’re trying to figure out how to pass values from the front-end to the function, (as part of the request), you can see: