I have several functions in my function app. Is there a way to have a setup/bootstrapper function run before all functions? This would be something that maybe sets up some global variables, logging, etc. I'm it would just be an index.ts file that gets run before each function.
Currently I'm doing this using a Higher Order function:
export function withSetup(fn) {
return (...args) => {
// Do some setup stuff here
return fn(...args);
};
}
This works but if you forget to wrap the function it can cause strange issues. I'm curious if there are other answers.