-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Remove flatiron/union dependency #483
Comments
@indexzero @BigBlueHat does union only provide middleware capability and buffering? Or is it more than that? |
@indexzero would be the one to answer the Thanks for all you're doing @thornjad! |
@thornjad primarily – In addition to native buffering it's also the main entry point for how the http(s) server is created. That aspect of With that in mind, we would just need a small "stack" library like //
// ... rest of the existing code above ...
// ... replacing res.emit('next') by invoking a next parameter ...
//
if (this.headers) {
before.unshift((req, res, next) => {
Object.keys(this.headers).forEach(header => {
res.setHeader(header, this.headers[header]);
});
next();
});
}
before.push(function onError(err, req, res, next) {
if (options.logFn) {
options.logFn(req, res, err);
}
res.end();
});
const handler = connect();
before.forEach(layer => handler.use(layer));
this.serverOptions = { handler };
if (options.https) this.https = options.https;
}
HttpServer.prototype.listen = function (port, host, callback) {
const key = this.serverOptions.https ? 'https' : 'http';
if (!callback) {
if (typeof host === 'function') {
callback = host;
host = null;
} else {
callback = function () {};
}
}
this.serverOptions[key].port = port;
if (host) this.serverOptions[key].host = host;
createServers(this.serverOptions, (err, servers) => {
if (err) return callback(err);
this.server = servers[key];
});
}; The above is totally untested, but I did quite a bit of re-reading the code and teasing apart the original the intention of what The only aspect that would be breaking here is if:
I also did not double check if any of the existing middlewares that Hope that helps! |
@indexzero of these 3, I suppose only the last one is the actual concern (i.e. the API surface area changes)? I have seen several issues/conversations in the past year which point to people doing the first 2 of those...but not sure how dependent they are on using the helper methods. |
My thought was that this would certainly be a breaking change. If post-breaking change there are a lot of issues around helper methods being missing then we could consider a small wrapper that adds them. In the meantime I would read the code for |
@indexzero thank you for the overview! That sets me on the right path! As for the "stack" library, we have lots of options. Of course there's connect, but there's also the newish koa and I noticed broadway. @indexzero @BigBlueHat are any of those clear winners? Any other libraries stand out? Broadway is maintained by @indexzero but hasn't been updated in a few years (though I could maybe put some work into it if there are issues). Connect is well established and I've used it in passing before. Koa is a newer player but is very active and backed by a good team (same people as Express). This would certainly be a breaking change, and it reminds me to ask, how is |
This comment has been minimized.
This comment has been minimized.
downgrade you node js from 12 to node 10. It helps to run angular micro front ends |
Hi @thornjad , some guy named @thornjad suggested you add #537 to your dependency list. Got an ETA on this? Also, any idea if the next node will remove the _headers interface? |
This issue has been inactive for 180 days |
still there in July 2024 |
We need to get off the outdated flatiron/union dependency because it's no longer necessary because Streams--see flatiron/union#61 (comment) for more.
@thornjad this relates to the PR you sent to flatiron/union. If you've still got coding cycle time, I'd love your help on this one!
PR's from anyone interested are also welcome. 😁
The text was updated successfully, but these errors were encountered: