Evenings,
Im trying to make a simple CRUD, adn I made the GET, so i guess de DB connection is OK, but when I try to make the POST, it throws me an error, 46201. I tried making the query in pgAdmin and it works (insert values in table), idk if its something with "quotes"
app.post('/books', (req, res) => {
const query = "INSERT INTO books (`title`,`description`,`coverimg`,`price`) VALUES ('$1,$2,$3,44);"
const title = "title_from_back";
const description = "back_desc";
const coverimg = "cover_pic_back";
const price = '33';
client.query(query, [ title, description, coverimg ],(err, data) => {
if (err) return res.json(err);
return res.json(data)
})
})
I tried changing the price for integer.
when I launch the crud using insomnia it response me an error:
{
"length": 90,
"name": "error",
"severity": "ERROR",
"code": "42601",
"position": "20",
"file": "scan.l",
"line": "1145",
"routine": "scanner_yyerror"
}
Thanks for helping.
Juan