Restructuring the folders
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build was killed

This commit is contained in:
2023-05-24 10:24:39 -04:00
parent 1fa308b2a9
commit b969adbc2e
27 changed files with 444 additions and 439 deletions

View File

@@ -0,0 +1,14 @@
import { Context, Next } from 'koa';
export const performanceLogger = async (ctx: Context, next: Next) => {
await next();
const rt = ctx.response.get('X-Response-Time');
console.log(`${ctx.method} ${ctx.url} - ${rt}`);
};
export const performanceTimer = async (ctx: Context, next: Next) => {
const start = Date.now();
await next();
const ms = Date.now() - start;
ctx.set('X-Response-Time', `${ms}ms`);
};