-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hooks api to framework package #7
Comments
This builds on some of the ideas proposed in Azure/azure-functions-nodejs-worker#664 Here's an idea I have for how we could do middleware: import { app } from "@azure/functions";
app.get("home", () => ({ body: "Hello World" });
app.middleware({
hookName: "preInvocation",
hook: (context) => {
//do stuff
}
});
app.preInvocation(context => {
//do stuff
});
app.middleware({
hookName: "preInvocation",
filter: "httpTrigger"
hook: () => {}
});
app.middleware({
hookName: "preInvocation",
filter: (context) => context.trigger.url.contains("foo"),
hook: () => {}
}); There's probably a bunch of additional permutations that we could support to make it more akin to the kind of middleware like you would come across in web frameworks, but also support the scenarios of having different trigger types within your application. |
Also, once Azure/azure-functions-nodejs-worker#665 is implemented, we can make the types available for the |
At the moment hooks are only exposed in the core api. However, we want the new programming model packages to wrap the core api and expose a "nicer" version of the hooks api (better intellisense, maybe better naming, full docs, etc.)
The text was updated successfully, but these errors were encountered: