I am newbee to Flask from perl.
Now as following I want to match by below route only for url list [/list/user, list/course, list/teacher, …], if request url such as "list/fxxk" will get 404. How to achieve this in a smart way.
Thanks to anyone if any help.
@app.route('/list/<object>')
def list_object(object):
# list all the object from DB
return object
I think I can do a match inside the function. I want to know if there is any elegant to do this.
>Solution :
Try flasks any converter:
@app.route('/list/<any(user, course, teacher):object>')
def list_object(object):
# list all the object from DB
return object