change middleware done result to own type

This commit is contained in:
2023-05-14 22:07:08 +02:00
parent b335bb61bd
commit 997fe6dc77
2 changed files with 33 additions and 17 deletions

View File

@@ -29,11 +29,12 @@ httpServer.preprocessor((_req, rep) => {
});
httpServer.middleware(async (req, _rep, done) => {
const processTime = await done();
const result = await done();
const hrArray: number[] = [0, Math.trunc(result.processTime * 1000000)];
if (!req.resourceRequest) {
console.log(
`${req.method} - ${req.remoteIpAddr} - ${req.path} - ${
prettyTime(processTime)
prettyTime(hrArray)
}`,
);
}