To make a method an API method, we need to use @app.route()
@app.route('/getStudent', methods=['GET','POST'])
The html file should come under
template
folder.
To call the html file from the method, we need to use
render_template('index.html')To send any information to the html file, we need to use
name
attribute.
render_template('homepage.html',username="Ahamed")In html file, we use to use this
username
with double curly braces
Hello {{username}}!To get to know the current API method whether GET, POST, PUT, DELETE, we need to use:
if request.method == 'POST':