Skip to content
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

Compatibility with middlewares #33

Closed
mhavelant opened this issue Jan 2, 2019 · 3 comments
Closed

Compatibility with middlewares #33

mhavelant opened this issue Jan 2, 2019 · 3 comments

Comments

@mhavelant
Copy link

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Add a middleware via app.use() [with or without the FastifyAdapter], e.g:

app.use((req, res, next) => { logger.info("This is a request."); next(); });
Then call /health/readiness (or any terminus routes). No message is logged for terminus routes (but it is for other custom routes).

Note: I also have morgan set up for more convenient request logging, it doesn't work either. Version:

"morgan": "^1.9.1",

Expected behavior

The above middleware should log "This is a request" to the console on every request to a terminus route.

Minimal reproduction of the problem with instructions

See "Current behavior".

What is the motivation / use case for changing the behavior?

Using middlewares is supported by nest, and logging requests is useful for debugging, bug tracing, etc., so it would be a great addition/fix.

Environment


Nest version: 5.5.0
Nest terminus version: 5.5.2

 
For Tooling issues:
- Node version: v10.15.0  
- Platform: Linux/Docker 

Others:

@llienard
Copy link

Hi,

I'm facing this issue too. I would like to add some authorization requirements to access the healthchecker url.

Is there any update about this ?

@oleg-yudovich
Copy link

oleg-yudovich commented Mar 8, 2020

Hi,

We must to be able to use our middlewares on health route.

Any updates regarding the fix?

@BrunnerLivio BrunnerLivio mentioned this issue Mar 14, 2020
3 tasks
@BrunnerLivio
Copy link
Member

BrunnerLivio commented Apr 5, 2020

Resolved in 7.0.0 🎉

Terminus v7 now uses the native NestJS route handler, therefore you can use the middleware as you are used to with NestJS!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants