move endpoint to middleware execution

This commit is contained in:
srgooglo 2021-07-08 12:08:48 +02:00
parent 4aa4720e93
commit 69ac40dbd8

View File

@ -113,7 +113,7 @@ class Server {
query.forEach((middleware) => {
if (typeof this.middlewares[middleware] === "function") {
this.middlewares[middleware](req, res, next)
this.middlewares[middleware](req, res, next, endpoint)
}
})
}
@ -163,10 +163,7 @@ class Server {
// expose information
this.httpServer.use((req, res, next) => {
req.requestId = nanoid()
req.endpoint = endpoint
res.setHeader("request_id", req.requestId)
next()
})