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.

Selectively apply middleware to some specific routes

See original GitHub issue

I am using this library to create a simple api gateway for my microservices . I am using preHandler to check which route needs the middleware but I am quiet lost after this point . My objective is to register the middleware in certain routes in my services only . How do I achieve that ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mcollinacommented, Apr 5, 2019

Yes! You’ll need to make some changes on these: https://github.com/fastify/fastify-http-proxy/blob/master/index.js#L43-L44.

0reactions
stale[bot]commented, Oct 21, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use specific middleware in Express for all paths except a ...
I would add checkUser middleware to all my paths, except homepage. app.get('/', routes.index); app.get('/account', checkUser, routes.account);.
Read more >
Using middleware - Express.js
Route handlers enable you to define multiple routes for a path. The example below defines two routes for GET requests to the /user/:id...
Read more >
[QUESTION] How to use different middleware for ... - GitHub
First check I used the GitHub search to find a similar issue and didn't find it. ... I have a need for route...
Read more >
Complete Guide to Express Middleware - Reflectoring
Application -level middleware which runs for all routes in an app object; Router level middleware which runs for all routes in a router ......
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 >

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