actualizacion de imagenes
This commit is contained in:
+17
-15
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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' ){
|
||||
|
||||
Reference in New Issue
Block a user