question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make middleware depends on context

See original GitHub issue

Hi! I have middleware that prefetch async data for further react rendering and it’s rely on some flags. So that flags can be uniq for each request on server side, what means that I need something like context in middleware for each router.start(url). Or put middleware function on each router.start instead of applying it once on router creation.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
trochcommented, Aug 4, 2016

End of the month is what I’m aiming for. I have two weeks holiday starting tomorrow, and during the 2nd week I’ll be able to focus on it a lot more.

0reactions
trochcommented, Sep 7, 2016

Do we really need it If we createRouter on each http request on server side

It is preferable. Since it’s not stateless, you can’t allow a single instance to be accessed by multiple requests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - How to use 'this' context in middleware - Stack Overflow
There are several techniques to bind the context, You can use apply, call, a closure, or the easier new ES6 arrow functions. This...
Read more >
Conditional Middleware based on request in ASP.NET Core
This post looks at how to configure ASP.NET Core middleware in a way that allows you to have different middleware for different types...
Read more >
ASP.NET Core Middleware | Microsoft Learn
Create a middleware pipeline with WebApplication ... Use(async (context, next) => { // Do work that can write to the Response. await next....
Read more >
Using immutable event and context changes in middleware
In my opinion it would make a lot of sense if middleware called next with optional event and context parameters that are then...
Read more >
Custom middleware with dependency injection in ASP.NET ...
Inversion of control container. We'll use this object to create instances of classes required by the middleware. IDictionary<string, object> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found