-
Hi Its me again! Im strugging running a global middleware after an enpoints end.... yes it needs to be global due the ammount of apis we handle. On the server.ts i put where TestMiddle is the Middleware that consolo log a hello world, but its never called. Can you help me to figure out how to use it correctly? Thnks a lot |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hello @zantler This is the base of express.js and middlewares ^^. Unfortunatly, the chance to execute the middleware at the end of the list is low. The middlewares are only execute until that the response isn’t sent to your consummer. So middlewares added via $afterRoutesInit hook are pushed after all routes and it’s generally to late to do something. Especially if you want to log something. |
Beta Was this translation helpful? Give feedback.
Hello @zantler
This is the base of express.js and middlewares ^^. Unfortunatly, the chance to execute the middleware at the end of the list is low. The middlewares are only execute until that the response isn’t sent to your consummer.
So middlewares added via $afterRoutesInit hook are pushed after all routes and it’s generally to late to do something. Especially if you want to log something.