Question · Python course · Module 5: Flask and Web Apps
HTTP Methods
How do you define an endpoint that accepts only GET and POST methods?
Answer options
- @app.route('/add', method='GET,POST')
- @app.route('/add', methods=['GET', 'POST'])
- @app.get_post('/add')
- @app.route('/add').methods('GET', 'POST')
You can check the correct answer by solving this task in the CodeWorlds game.