Add user GET endpoint, schemas, and security middlewares

Introduces GET /users/:id endpoint with validation schema, adds tests for user and register routes, and applies security middlewares (helmet, hpp, cors) to the server. Also adds ESLint configuration and updates logger with linting comments.
This commit is contained in:
2025-12-22 13:26:13 +01:00
parent 7e1eaf3f1f
commit 335aef34e3
13 changed files with 1182 additions and 24 deletions

View File

@@ -33,11 +33,13 @@ function write($stream, level, color, content, extraLabels = []) {
}
}
// eslint-disable-next-line no-console
console.log(`[${date}] `.magenta + `[${level}]`[color] + consoleLabels + " " + message)
$stream.write(`[${date}] [${level}]${fileLabels} ${stripColors(message)}\n`)
}
function createLogger(root) {
// eslint-disable-next-line no-useless-escape
const fileName = (/false/).test(process.env.IS_PROD.toLowerCase()) ? new Date().toLocaleString("fr-FR", { timeZone: "UTC" }).replace(/[\/:]/g, "-").replace(/ /g, "_") : "DEV-LOG"
const logsDir = path.join(root, "logs")
@@ -77,6 +79,7 @@ function stripColors(string) {
if (!string || typeof string !== "string") {
return string
}
// eslint-disable-next-line no-control-regex
return string.replace(/\x1B\[[0-9;]*[mK]/g, "")
}