actualizacion de imagenes

This commit is contained in:
2020-08-12 01:53:57 -05:00
parent 7ddaefcb28
commit 01348727e8
2 changed files with 18 additions and 15 deletions
+17 -15
View File
@@ -19,29 +19,31 @@ function query(consulta) {
app.get('/libroDetalle', async(req, res) => {
let data = req.query;
if( typeof( data.idLibro ) === 'undefined' ){
res.status(400).json({error: true, msj: 'Falta el ID del libro como parametro'});
return;
}
console.log(` Este es el id: ${data.idLibro}`);
let sqlString = `SELECT * from Libro where idLibro=${data.idLibro}`;
console.log(` Esta es la cadena : ${sqlString}`);
let respuestaSql = await query(sqlString);
respuestaSql = respuestaSql[0];
if(respuestaSql.length === 0 ){
res.status(400).json({error: true, msj: 'No se encontro el libro solicitado'});
return;
}
try{
res.status(200).json({error:false, msj: 'exito', data: respuestaSql})
console.log(`Se hizo una peticion ${data.idLibro}`);
console.log(` Este es el id: ${data.idLibro}`);
let sqlString = `SELECT * from Libro where idLibro=${data.idLibro};`;
console.log(` Esta es la cadena : ${sqlString}`);
let respuestaSql = await query(sqlString);
respuestaSql = respuestaSql[0];
if(respuestaSql.length === 0 ){
res.status(400).json({error: true, msj: 'No se encontro el libro solicitado'});
return;
}
res.status(200).json({error:false, msj: 'exito', datos: respuestaSql})
}
catch(error){
res.status(400).json({error: true, msj: 'No se pudo obtener la imagen', desc: error});
res.status(400).json({error: true, msj: 'No se pudo obtener la el libro', desc: error});
return;
}
+1
View File
@@ -19,6 +19,7 @@ function query(consulta) {
app.get('/libroImagen', async(req, res) => {
console.log(`Entro a imagenes`);
let data = req.query;
if( typeof( data.idLibro ) === 'undefined' ){