title: I can't send post request from react form to flask server
body: <p>I have a reactjs as a frontend and flask server as a backend. I'm trying to send data from register form (using Formik). When I do a post request I have an error 500.
  I notice that when I'm using postman everything is good and flask create new record in postgresql.</p>
  
  <p>frontend is on <code>http://localhost:3000/register</code>,
  backend is on <code>http://localhost:5002/adduser</code>
  What I should do now ?</p>
  
  <pre><code>function handleSubmit(values, actions) {
  
    const options = {
      headers: {
        'Content-type': 'application/json',
        'Access-Control-Allow-Origin': '*',
        'Referrer-Policy': 'origin-when-cross-origin'
      },
      method: 'POST',
      mode: 'no-cors',
      body: JSON.stringify(values)
    }
  
  fetch('http://localhost:5002/adduser', options)
      .then(response =&gt; console.log(response))
      .catch(error =&gt; console.error(error))
  }
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code>@app.route('/adduser', methods=['GET', 'POST'])
  def register():
    if request.method == "POST":
      print(request.form['userName'])
      print(request.form['email'])
      data = {
        'name': request.form['userName'],
        'surname': request.form['surname'],
        'email': request.form['email'],
        'user_password': request.form['password'],
        'phone_number': request.form['phoneNumber']
      }
      mydb = Database(host=os.getenv('host'), database=os.getenv('database'), user=os.getenv('user'), password=os.getenv('password'))
      mydb.insert_data(data)
  
      return jsonify({'mydata': data})
  
      # name = request.form['name']
      # surname = request.form['surname']
      # email = request.form['email']
      # password = request.form['password']
      # phone_number = request.form['phoneNumber']
    return "&lt;h1&gt;Hello Flask&lt;/h1&gt;"
  
  if __name__ == "__main__":
      app.run(debug=True, port=5002)
      app.secret_key = os.urandom(24)
  </code></pre>