# Code coverage report for api/routers/authRoutes.js

# All files / api/routers authRoutes.js

0% Statements 0/13
100% Branches 0/0
0% Functions 0/5
0% Lines 0/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44

     const express = require('express');

    /**
     * Auth Routes
     * Public endpoints (nincs JWT védelem)
     *
     * @param {Container} container - DI Container
     */
    function createAuthRoutes(container) {
      const router = express.Router();

      // AuthController lekérése a DI Container-ből
      const authController = container.resolve('AuthController');

      /**
       * POST /api/auth/register - User regisztráció
       * Body: { name, email, password }
       * Response: { user, token }
       */
      router.post('/register', (req, res) => authController.register(req, res));

      /**
       * POST /api/auth/login - User bejelentkezés
       * Body: { email, password }
       * Response: { user, token }
       */
      router.post('/login', (req, res) => authController.login(req, res));

      /**
       * POST /api/auth/logout - User kijelentkezés
       * Clears the authentication cookie
       */
      router.post('/logout', (req, res) => authController.logout(req, res));

      /**
       * OPTIONS /api/auth/* - CORS preflight
       */
      router.options('*', (req, res) => res.sendStatus(204));

      return router;
    }

    module.exports = createAuthRoutes;