We sent route support for HTTP triggers to Azure Functions. Now you can add a route property that follows the ASP.NET Web API route naming syntax. (You can install it directly through Function.json or through the UX portal)
"route": "node/products/{category:alpha}/{id:guid}"
Function.json:
{
"bindings": [
{
"type": "httpTrigger",
"name": "req",
"direction": "in",
"methods": [ "post", "put" ],
"route": "node/products/{category:alpha}/{id:guid}"
},
{
"type": "http",
"name": "$return",
"direction": "out"
},
{
"type": "blob",
"name": "product",
"direction": "out",
"path": "samples-output/{category}/{id}"
}
]
}
.NET:
public static Task<HttpResponseMessage> Run(HttpRequestMessage request, string category, int? id,
TraceWriter log)
{
if (id == null)
return req.CreateResponse(HttpStatusCode.OK, $"All {category} items were requested.");
else
return req.CreateResponse(HttpStatusCode.OK, $"{category} item with id = {id} has been requested.");
}
NodeJS:
module.exports = function (context, req) {
var category = context.bindingData.category;
var id = context.bindingData.id;
if (!id) {
context.res = {
body: "All " + category + " items were requested."
};
}
else {
context.res = {
body: category + " item with id = " + id + " was requested."
};
}
context.done();
}
: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook#url-to-trigger-the-function
, Azure API Management, .
PR Azure. , . https://github.com/Azure/azure-webjobs-sdk-script/pull/490
a >
: PM Azure Functions