From 9753917af11b22cc5115bef2ab0f2cdd41aca78b Mon Sep 17 00:00:00 2001
From: Jesus Galaz <jesusgalazr@icloud.com>
Date: Mon, 14 Oct 2024 11:34:01 +0200
Subject: [PATCH] Changing comments to english

---
 public/index.html  | 2 +-
 public/js/auth.js  | 5 +++--
 public/js/index.js | 2 +-
 routes/todos.js    | 3 +--
 routes/users.js    | 8 ++++----
 server.js          | 8 ++++----
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/public/index.html b/public/index.html
index ceb9136..ca170f1 100644
--- a/public/index.html
+++ b/public/index.html
@@ -25,7 +25,7 @@
           <button type="submit">Add</button>
         </form>
 
-        <!-- Lista de tareas -->
+        <!-- Todo List -->
         <section class="task-list">
           <ul id="task-list"></ul>
         </section>
diff --git a/public/js/auth.js b/public/js/auth.js
index 0911918..2013da9 100644
--- a/public/js/auth.js
+++ b/public/js/auth.js
@@ -1,5 +1,6 @@
 document.addEventListener('DOMContentLoaded', () => {
-  // Registro
+  
+  // Register
   const registerForm = document.getElementById('register-form');
   if (registerForm) {
     registerForm.addEventListener('submit', async (event) => {
@@ -36,7 +37,7 @@ document.addEventListener('DOMContentLoaded', () => {
     });
   }
 
-  // Inicio de sesión
+  // Login In
   const loginForm = document.getElementById('login-form');
   if (loginForm) {
     loginForm.addEventListener('submit', async (event) => {
diff --git a/public/js/index.js b/public/js/index.js
index ad7a733..5d80645 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1,7 +1,7 @@
 document.addEventListener('DOMContentLoaded', async () => {
     const logoutBtn = document.getElementById('logout-btn'); 
   
-    // Evento para el botón de logout
+    // Event for the logout button
     logoutBtn.addEventListener('click', async () => {
         try {
           const res = await fetch('/api/users/logout', { method: 'POST' });
diff --git a/routes/todos.js b/routes/todos.js
index fb0286b..8154cf9 100644
--- a/routes/todos.js
+++ b/routes/todos.js
@@ -2,7 +2,7 @@ const express = require('express');
 const router = express.Router();
 const Todo = require('../models/todo');
 
-// Middleware para verificar si el usuario está autenticado
+// Middleware to verify if the user is authenticated
 function isAuthenticated(req, res, next) {
   if (req.session.user) {
     return next();
@@ -18,7 +18,6 @@ router.post('/logout', (req, res) => {
       console.error('Error al destruir la sesión:', err);
       return res.status(500).json({ error: 'Error al cerrar sesión' });
     }
-    // Redirigir al cliente o enviar una respuesta exitosa
     res.status(200).json({ message: 'Logout successful' });
   });
 });
diff --git a/routes/users.js b/routes/users.js
index cf9fc04..13da3ed 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -8,16 +8,16 @@ router.post('/register', async (req, res) => {
   const { username, password } = req.body;
   
   try {
-    // Verificar si el usuario ya existe
+    // Verify if the user exists
     const existingUser = await User.findOne({ username });
     if (existingUser) {
       return res.status(400).json({ error: 'User already exists' });
     }
 
-    // Encriptar la contraseña antes de guardarla
+    // Encrypt the password
     const hashedPassword = await bcrypt.hash(password, 10); 
 
-    // Crear un nuevo usuario con la contraseña encriptada
+    // Creating a new user with the encrypted password
     const user = new User({ username, password: hashedPassword });
     await user.save();
 
@@ -59,7 +59,7 @@ router.post('/login', async (req, res) => {
 });
 
 
-// Cerrar sesión del usuario
+// Closing user session
 router.post('/logout', (req, res) => {
   req.session.destroy(err => {
     if (err) {
diff --git a/server.js b/server.js
index 96eccca..8dc73f1 100644
--- a/server.js
+++ b/server.js
@@ -9,7 +9,7 @@ const app = express();
 app.use(express.json());
 app.use(express.static(path.join(__dirname, 'public')));
 
-// Configuración de la sesión
+// Session configuration
 app.use(
   session({
     secret: 'session_secret',
@@ -19,13 +19,13 @@ app.use(
   })
 );
 
-// Conectar a MongoDB
+// Connection to MongoDB
 connectDB();
 
-// Rutas
+// Routes
 app.use('/api/todos', require('./routes/todos'));
 app.use('/api/users', require('./routes/users'));
 
-// Iniciar el servidor
+// Initialize the server
 const PORT = process.env.PORT || 3000;
 app.listen(PORT, () => console.log(`Server running on port ${PORT}`));
-- 
GitLab