Base-REST-API/routes/register.js
azures04 335aef34e3 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.
2025-12-22 13:26:13 +01:00

15 lines
462 B
JavaScript

const express = require("express")
const router = express.Router()
const registerService = require("../services/register")
router.post("/", async (req, res) => {
const { email, username, password } = req.body
const registerResult = registerService.register({ email, username, password })
return res.status(200).json({
code: 200,
message: "User successfully registered",
data: registerResult
})
})
module.exports = router