Created
October 31, 2022 21:02
-
-
Save alphanetEX/e753dd7f6432e3c46487631764d2168b to your computer and use it in GitHub Desktop.
stable request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lastProduct: (req, res) => { | |
console.log("ejecutando request"); | |
db.Product.findAll({ | |
include : ["Images"], | |
order: [[ ,'id' , 'DESC']], | |
}) | |
.then(data => { | |
let object = data[0].dataValues; | |
let producto = { | |
id: object.id, | |
name: object.name, | |
typeId: object.typeId, | |
type: object.Type, | |
price: object.price, | |
discount: object.discount, | |
image: `http://localhost:3000/images/products/`+ object.Images[0].fileName, | |
description: object.description, | |
}; | |
res.status(200).json( { | |
status:200, | |
producto, | |
detalle: "api/products/"+object.id, | |
}); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment