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:
@@ -1,9 +1,12 @@
|
||||
const express = require("express")
|
||||
const hpp = require("hpp")
|
||||
const app = express()
|
||||
const cors = require("cors")
|
||||
const path = require("node:path")
|
||||
const utils = require("./modules/utils")
|
||||
const Logger = require("./modules/logger")
|
||||
const logger = Logger.createLogger(__dirname)
|
||||
const utils = require("./modules/utils")
|
||||
const helmet = require("helmet")
|
||||
const loader = require("./modules/loader")
|
||||
const DefaultError = require("./errors/DefaultError")
|
||||
const path2regex = require("path-to-regexp")
|
||||
@@ -13,6 +16,10 @@ const schemas = loader.getRecursiveFiles(path.join(__dirname, "schemas"))
|
||||
|
||||
const schemaRegistry = {}
|
||||
|
||||
app.use(hpp())
|
||||
app.use(helmet())
|
||||
app.use(cors({ origin: "*" }))
|
||||
|
||||
app.use(express.json())
|
||||
app.use(express.urlencoded({ extended: true }))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user