Actualización de función /planes en base de datos + primera versión del README

This commit is contained in:
2025-08-25 16:05:12 +00:00
parent 5342fb489d
commit f7962f894d
3 changed files with 310 additions and 8 deletions
+6 -7
View File
@@ -72,19 +72,18 @@ app.get('/',(req, res) => res.sendFile(path.join(__dirname, 'pages', 'index.html
app.get('/planes', async (req, res) => {
try {
const result = await pool.query(`
SELECT id, nombre, descripcion, precio
FROM plan
WHERE activo = true
ORDER BY id
`);
res.json(result.rows);
const { rows: [row] } = await pool.query(
'SELECT api.get_planes_json($1) AS data;',
[true]
);
res.type('application/json').send(row.data);
} catch (err) {
console.error(err);
res.status(500).json({ error: 'Error al cargar planes' });
}
});
app.post('/api/registro', async (req, res) => {
const {
nombre_empresa,