Is it possible to directly declare a flask URL optional parameter?

Currently I’m proceeding the following way:

@user.route('/<userId>')
@user.route('/<userId>/<username>')
def show(userId, username=None):
    pass

How can I directly say that username is optional?

11 Answers
11

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *