I have developed a basic Flask jsonify function that returns a JSON Object, although I am not certain if it qualifies as an API.
@app.route('/searchData/<int:id>',methods=["GET"])
def searchData(id):
return jsonify(searchData(id))
Currently, when using the Fetch function, I am unable to pass the argument <int:id>
. I am unsure if it is possible to add parameters to the Header in Flask to accept this argument.
async fetch(id){
const res = await fetch(
"http://localhost:5000/searchData/",
{
method:"GET"
}
);
const data = await res.json()
console.log(data)
}