I'm trying to specify an optional parameter to my flask restful api.
I have the following route defined where mode is optional.
My route is defined like so
api.add_resource(TestController, "/test/<id>/<mode>")
My controller is defined like so:
class TestController(Resource):
def get(
self,
id: int,
mode: int = -1,
):
I read one way to do it is like so
api.add_resource(TestController, "/test/<id>/")
api.add_resource(TestController, "/test/<id>/<mode>")
But this causes an error for me and gives me :
AssertionError: View function mapping is overwriting an existing endpoint function: loggers