I’m trying to convert flask API to azure functions.
@app.route(route="{directory_name}/static/{file_path:path}", auth_level=func.AuthLevel.ANONYMOUS,
methods=[func.HttpMethod.GET])
def serve_static(req: func.HttpRequest) -> func.HttpResponse:
....
In flask, the route with {file_path:path}
works but in azure function I’m getting this error:
Microsoft.AspNetCore.Routing: An error occurred while creating the route with name ‘serve_static’ and template ‘{directory_name}/static/{file_path:path}’. Microsoft.AspNetCore.Routing: The constraint entry ‘file_path’ – ‘path’ on the route ‘{directory_name}/static/{file_path:path}’ could not be resolved by the constraint resolver of type ‘DefaultInlineConstraintResolver’.
I looked for something similar but I cant seem to find something helpful.
Chaima JABALLAH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.