diff --git a/.DS_Store b/.DS_Store index b64aba4..c9c43e3 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/index.js b/index.js index 222543b..13b8186 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ const express = require('express'); const app = express(); const mysql = require('mysql'); const path = require('path'); +const bodyParser = require('body-parser'); const port = process.env.PORT || 3000; @@ -21,9 +22,10 @@ app.set('view engine', 'ejs'); app.set('views', path.join(__dirname, 'src/views')); app.use(express.static(path.join(__dirname, 'src'))); +app.use(bodyParser.json()); app.get("/", (req, res) => { - res.sendFile(path.join(__dirname, 'src', 'index.html')); + res.sendFile(path.join(__dirname, 'src/index.html')); }); app.get("/seguimiento", (req, res) => { @@ -34,8 +36,21 @@ app.get("/seguimiento", (req, res) => { }); }); -app.get("/empleadoTest", (req, res) => { - res.sendFile(path.join(__dirname, 'src', 'empleadoTest.html')); +app.get("/colaborador", (req, res) => { + res.sendFile(path.join(__dirname, 'src/colaborador.html')); +}); + +app.post('/actualizar_valor', (req, res) => { + const nuevoValor = req.body.valor; + const query = 'UPDATE Datos SET valor = ? WHERE id = ?'; + db.query(query, [nuevoValor, '463912'], (err, result) => { + if (err) { + console.error('Error al actualizar el valor:', err); + res.status(500).send('Error al actualizar el valor'); + return; + } + res.send('Valor actualizado correctamente'); + }); }); app.listen(port, () => { diff --git a/src/.DS_Store b/src/.DS_Store index 239a2a4..ebb5f9b 100644 Binary files a/src/.DS_Store and b/src/.DS_Store differ diff --git a/src/empleadoTest.html b/src/colaborador.html similarity index 64% rename from src/empleadoTest.html rename to src/colaborador.html index 0953314..e4007ad 100644 --- a/src/empleadoTest.html +++ b/src/colaborador.html @@ -11,8 +11,6 @@