I have a Route named search: @app.route('/search') Is it possible to add multiple optional parameters to it? Example:
@app.route('/search/pg/<int:pg>')
@app.route('/search/types/<types>')
@app.route('/search/number/<int:number>')
@app.route('/search/subject/<subject>')
The order in the URL shouldnt matter, so I could call /search/pg/2, or /search/subject/MySubject/pg/2 or /search/types/posts/subject/MySubject/pg/2
I tried this, but it only works with the full paths and all the parameters:
@app.route('/search/pg/<int:pg>/types/<types>/subject/<subject>', methods=['GET', 'POST'])
@app.route('/search/subject', defaults={'subject', None})
@app.route('/search/pg/<int:pg>/types/<types>', methods=['GET', 'POST'])
@app.route('/search/types', defaults={'types', None})
@app.route('/search', defaults={'pg': 1}, methods=['GET', 'POST'])
@app.route('/search/pg/<int:pg>', methods=['GET', 'POST'])
def search(pg, types=None, subject=None):
pass