An Azure service that provides an event-driven serverless compute platform.
You can do the below which should work to set an empty route on an HttpTrigger
Route = "{x:regex(^$)?}"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In Azure Functions I have a host setup like the below:
{
"version": "2.0",
"logging": {
...
}
},
"extensions": {
"http": {
"routePrefix": "api/test"
}
}
}
I want to setup an http trigger that will have an empty route, IE: the endpoint would be api/test/ No route appears to default to the function name and the docs are not conclusive if an empty string as route will work? Is there a way to achieve this?
Sample HttpTrigger:
[Function("HttpFunction")]
public IActionResult Run(
// should be called with `api/test/`
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "")] HttpRequest req)
{
return new OkObjectResult($"This was called with `api/test/`");
}
An Azure service that provides an event-driven serverless compute platform.
You can do the below which should work to set an empty route on an HttpTrigger
Route = "{x:regex(^$)?}"
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more