Looking to transition from v3 to v4 with the help of this documentation: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v3%2Cfunctionsv2&pivots=programming-language-typescript
My goal is to update the code below to match v4 specifications.
In v3:
import { AzureFunction, Context, HttpRequest } from "@azure/functions"
const cgHttpTrigger: AzureFunction = async (
context: any,
req: any,
httpTrigger: AzureFunction
) => {
return appInsights.wContext(async () => {
const startTime = Date.now() // Start trackRequest timer
// Execute the Function
await httpTrigger(context, req)
// Track Request upon completion
a.d.trackRequest({
name: context.req.method + " " + context.req.url,
resultCode: context.res.status,
}, correlationContext ?? undefined)()
}
Attempting to incorporate version 4 functions and wrapping the above function accordingly.
In v4:
import { app} from '@azure/functions';
app.http('appIn', {
methods: ['GET', 'POST'],
handler: cgHttpTrigger(httpTrigger),
});
Is there a way to wrap this in a format like:
handler: async (req, context) => {return cgHttpTrigger(req, context, (req, context) => {....})}
Additional Resources:
https://www.npmjs.com/package/applicationinsights/v/2.0.0-beta.200831.1
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v3%2Cfunctionsv2&pivots=programming-language-typescript using this documentation