diff --git a/db/bd.js b/db/bd.js index 8c5d8e6..bf5d026 100644 --- a/db/bd.js +++ b/db/bd.js @@ -1,22 +1,22 @@ require('dotenv').config(); const mySQL = require('mysql2'); -// Conexion local -const connection = mySQL.createConnection({ - host: "localhost", - user: "root", - password: "admin123", - database: "online_shop", - port: 3303 -}); -// // Conexion para deploy +// // Conexion local // const connection = mySQL.createConnection({ -// host: process.env.DB_HOST, -// user: process.env.DB_USER, -// password: process.env.DB_PASSWORD, -// database: process.env.DB_NAME, -// port: process.env.DB_HOST +// host: "localhost", +// user: "root", +// password: "admin123", +// database: "online_shop", +// port: 3303 // }); +// Conexion para deploy +const connection = mySQL.createConnection({ + host: process.env.DB_HOST, + user: process.env.DB_USER, + password: process.env.DB_PASSWORD, + database: process.env.DB_NAME, + port: process.env.DB_HOST +}); connection.connect(error => { if (error) { diff --git a/public/js/shop.js b/public/js/shop.js index 63d43d1..09e9dd0 100644 --- a/public/js/shop.js +++ b/public/js/shop.js @@ -1,6 +1,6 @@ -console.log("Aqui vemos y agregamos productos"); document.addEventListener('DOMContentLoaded', () => { + console.log("Aqui vemos y agregamos productos"); const listaDeProductos = document.getElementById('product_list'); const editarProductoForm = document.getElementById('editarProductoForm'); @@ -46,7 +46,7 @@ document.addEventListener('DOMContentLoaded', () => { // Listar todos los productos async function listarProductos() { - const response = await fetch('product/all'); + const response = await fetch('/product/all'); // Manejo de errores HTTP if (!response.ok) {