When building an application in Azure Functions you can specify the HTTP Methods that are accepted in the function.json
Given an API that you can do multiple functions on (GET, PUT POST etc) what is the best way to create that function or functions.
There will be shared logic and libraries that need to be available, so I'm looking for a pattern that can enable all the MEthods in a single class, but not sure how you would define that in a function.json such that each HTTP Method could have its own entry point.
The other option is to create a function that basically chooses the method and class that function but this seems like some middleware overhead that I"m sure can be handled in a better way.
i.e. I don't think I should do this for every object that I create a function for and there must be a better pattern.
async HandleRequest(){
return validateJwt(function(context,req){
if(req.method === 'GET'){
}
else if(req.method === 'POST'){
}
else if(req.method === 'DELETE'){
}
else if(req.method === 'PUT'){
}
else if(req.method === 'PATCH'){
}
});
}