Implement middleware for responders / subscribers
See original GitHub issueCertain functions such as auth or request decoration would make use of middlewares, as in, virtually everywhere (Express & co).
The following code…
responder.on('request', function(req, cb) {
// do something;
});
should still work with a middleware:
responder.on('request', middleware, function(req, cb) {
// do something if middleware allows
});
Issue Analytics
- State:
- Created 7 years ago
- Reactions:15
- Comments:9 (4 by maintainers)
Top Results From Across the Web
middleware-responder examples - CodeSandbox
Learn how to use middleware-responder by viewing and forking example apps that make use of middleware-responder on CodeSandbox.
Read more >implementation - Go Packages
Responder ; func PostMOM(params monitoring_machine.PostMoMParams) middleware.Responder; func SubscribeES(params subscribers.
Read more >How to implement StackMiddleware for a redirection correctly?
How do I use my redirection code (which I know works) with this StackMiddleware class so I can intercept the page cache?
Read more >rabbus-custom - npm Package Health Analysis | Snyk
Rabbus.Subscriber; Rabbus.Responder. Extending Rabbus w/ Middleware. Rabbus message Producers and Consumers use a middleware system that allows you to extend ...
Read more >rabbus - npm
Rabbus.Subscriber; Rabbus.Responder. Extending Rabbus w/ Middleware. Rabbus message Producers and Consumers use a middleware system that allows you to extend ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dashersw I’ve come up with a pretty clear idea of middleware based on express which will require no breaking changes and still support callbacks.
src/components/responder.js
Examples -
Requester
Responder
Output
I’ll ready a PR if you find this helpful and after testing it a bit more. 😉
Just from personal interest, here is a little function which enables a certain set of express-like features.
src/components/responder.js
the requester example:
the responder with middleware:
and the output from the requester
It is by far just a proof of concept, not clean and only tested on my side. It is just an idea how to solve the implementation of middleware and I am aware of the fact, that this implementation restructures the responder process.
Edit: merged actual request object from requester with the request object for the middleware.