Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,855 questions
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/`");
}
You can do the below which should work to set an empty route on an HttpTrigger
Route = "{x:regex(^$)?}"