-
Notifications
You must be signed in to change notification settings - Fork 19
Provide extensibility scenario for app
namespace
#55
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
Comments
cc @jviau |
I had a chat with @ejizba on an internal thread about this as well, as being able to extend the |
I would like to see user feedback and other examples in the Node.js ecosystem before we spend time on this. I'm not convinced it's a problem or that the solutions suggested are idiomatic to Node.js. My gut is telling me that people are used to having a lot of npm packages and would be fine with importing some stuff from |
I wonder if a more approachable middleware option might fill the gap. One of the projects I was experimenting with is my Open API extension (https://github.com/aaronpowell/azure-functions-nodejs-openapi) and how to register Open API against the endpoint(s) that you have. My initial thought was to have an extension method on the Middleware might tackle this: import { app } from "@azure/functions";
import { openApiMiddleware } from "...";
app.middleware(openApiMiddleware({ ... }), "http");
app.get(...); the Not sure if that'd improve durable's design though. |
Related to #12. Currently, the
app
object provided from the root of the@azure/functions
library (in v4), is a namespace:This provides limited extensibility when it comes to users/other packages adding their own methods to the root
app
namespace. For example, the Durable SDK had no easy way to add anapp.durableOrchestration()
method to register durable functions, and instead it has to export its own functions under its own namespace.This issue is to discuss how/if we should provide a way for another package to extend the
app
namespace with their own methods. One such suggestion would be to makeapp
an instance of a Class instead of an object, which can then be extended by other packages. Example:Instead of using the
new FuncApp()
syntax, which may not be very idiomatic to node, we could also follow Express's model and export a function that does this behind the scenes. Example:There could be other ways of providing this extensibility too, but this is the easiest one I could think of 🙂
The text was updated successfully, but these errors were encountered: