🚀 Backend komplett implementiert
Features: - Auth mit JWT + Argon2 (Login, Register, Refresh) - Rollen-System (Chef/Disponent/Mitarbeiter) - User Management mit Berechtigungen - Aufträge mit Zuweisungen - Verfügbarkeitsplanung - Stundenzettel mit Foto-Upload Support - Modulares System mit Config - Entwickler-Panel Endpoints Tech: - Deno + Oak - PostgreSQL - CORS enabled
This commit is contained in:
17
src/middleware/logger.ts
Normal file
17
src/middleware/logger.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Context, Next } from "@oak/oak";
|
||||
|
||||
export async function requestLogger(ctx: Context, next: Next): Promise<void> {
|
||||
const start = Date.now();
|
||||
|
||||
await next();
|
||||
|
||||
const ms = Date.now() - start;
|
||||
const status = ctx.response.status;
|
||||
const method = ctx.request.method;
|
||||
const url = ctx.request.url.pathname;
|
||||
|
||||
const color = status >= 500 ? "\x1b[31m" : status >= 400 ? "\x1b[33m" : "\x1b[32m";
|
||||
const reset = "\x1b[0m";
|
||||
|
||||
console.log(`${color}${status}${reset} ${method} ${url} - ${ms}ms`);
|
||||
}
|
||||
Reference in New Issue
Block a user