-
Notifications
You must be signed in to change notification settings - Fork 71
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
[RFC] 0005 Server Middleware Extensibility #151
Conversation
|
hi im currently missing som topic about middlewares from dependencies like we have it in the builder. In the builder it is currently that every application/library can define there own build steps and they run only for the coresponding like So when we have to some how also respect this for the middlewares because we alway develop on the source of the libraries and so the corresponding middlewares need to run only on requests to there own source. |
@sebbi08 Thanks for your comment. It is currently not planned to detect/include server middleware of dependent projects. However, the custom server middleware can be located in a dependency. Assuming the extension is defined in that projects ui5.yaml file. This dependency can then be included in your project. Regards, |
@svbender thats true but lets asume we dont have a "simple" middleware like transpiling in module.exports = async function({workspace, dependencies, options}) {
return function (req, res, next) {
// middleware code...
next();
}
}; while developing the files need would be found in the |
Custom middleware function should be async.
Custom middleware function should be async.
@sebbi08: We reconsidered this feature and tried to work in your feedback. |
@Thodd thats a nice way. now we can write the middleware in the dependencie and also reuse it from there. thanks |
First of all once again: Thanks for your great work! Any updates on this RFC? Is it already on the roadmap? When can we expect some progress? BR |
@cschuff Hi Christian, LTNS 😉, middleware extensibility is one of our major topics, and while finishing some other important tooling topics, we'd like to continue on it soon, i.e. the next weeks/month(s). |
Hi Andreas 👋, that is great news. ui5-tooling really is a major improvement to the ui5 dev ecosystem! |
A middleware module must either return a function or a promise resolving to a function. This should allow for future, async use-cases while being compatible with the way most middleware modules are written today (synchronous).
type: middleware should be server-middleware
…ensions As per RFC 0005: SAP/ui5-tooling#151
As per RFC 0005: SAP/ui5-tooling#151
Demo: SAP/openui5-sample-app#50 Based on WiPs SAP/ui5-project#190 and SAP/ui5-server#200 |
As per RFC 0005: SAP/ui5-tooling#151
I don't quite like the idea of having the both sync and async options for the middleware functions. So I would like to go back to my initial opinion to make the middlewares always return a function, not a Promise. |
…ensions As per RFC 0005: SAP/ui5-tooling#151
@matz3 While implementing SAP/ui5-server#200, knowing that the middleware modules could return a promise lead to some good design choices allowing them to do so in the future. We could definitely start with synchronous middleware modules now and wait for someone to come up with a good use case for returning a promise in the createMiddleware function. Again, my idea was that a middleware could do some initial processing with the |
We decided to remove the It was meant to offer a quick way to integrate generic middleware modules that do not make use of UI5 Tooling specific APIs and therefore do not require any UI5 Server specific implementation. Also, they must not require any configuration to be passed to them. An example is the helmet module. To consume such modules with the current state of the RFC, you now need to wrap such modules into a custom middleware extension. Please let us know if you would like to see this additional feature in a future version of the UI5 Server. |
…ensions As per RFC 0005: SAP/ui5-tooling#151
…ensions As per RFC 0005: SAP/ui5-tooling#151
…ensions As per RFC 0005: SAP/ui5-tooling#151
Documentation now available at https://sap.github.io/ui5-tooling/pages/extensibility/CustomServerMiddleware/ 🐴 |
As per RFC 0005: SAP/ui5-tooling#151
As per RFC 0005: SAP/ui5-tooling#151
As per RFC 0005: SAP/ui5-tooling#151
As per RFC 0005: SAP/ui5-tooling#151
Read the current draft here: 0005-server-middleware-extensibility.md