Initial project structure and core modules

Add environment example, update .gitignore, and switch license to AGPL v3. Introduce error handling classes, ESLint config, and main modules for database, logging, certificate management, and utility functions. Add authentication routes, schemas, and service layer for a modular REST API. Update README and set up repository structure for further development.
This commit is contained in:
2025-12-23 15:59:43 +01:00
parent 4e822b4868
commit 0b1662d8ca
32 changed files with 4656 additions and 88 deletions

25
routes/register.js Normal file
View File

@@ -0,0 +1,25 @@
const path = require("node:path")
const express = require("express")
const router = express.Router()
const Logger = require("../modules/logger")
const logger = Logger.createLogger(path.join(__dirname, ".."))
const authService = require("../services/authService")
router.post("/", async (req, res) => {
const { username, password, email, registrationCountry, preferredLanguage } = req.body
const clientIp = req.headers["x-forwarded-for"] || req.connection.remoteAddress
const result = await authService.registerUser({
username,
password,
email,
registrationCountry,
preferredLanguage,
clientIp
})
logger.log(`New user registered: ${username}`, ["Web", "yellow", "AUTH", "green"])
return res.status(200).json(result)
})
module.exports = router