I'm trying to send data from my reactjs app to flask api. I'm returning the following from function App()
return(
<div>
<form onSubmit={handleSubmit} action="http://localhost:5000/mongodb" method="POST">
<fieldset>
<label>
<p>User ID:</p>
<input type="text" name="uid"/>
<button type="submit">Submit</button>
</label>
</fieldset>
</form>
<h1...
where uid is a 4 digit number
I'm trying to accept the same from my flask api in this way
@app.route('/mongodb',methods = ['POST'])
def mongo_rec():
try:
if(request.method == 'POST'):
uid = request.form('UID')
I don't know where I've gone wrong , kindly point it out.