I'm a complete beginner in Node.js and I want to send registered variable and claimed variable at the same time in the form of JSON via Express.js
This is the only thing I came up with right now and it does not even work.
app.get('/item_reg', (req, res) => {
var registered = connection.query("SELECT JSON_OBJECT('name', item_name, 'item_id', item_id, 'location', location_desc, 'color', color, 'description', description, 'image', image_url) AS 'Registered' FROM Items_found WHERE type = 0");
var claimed = connection.query("SELECT JSON_OBJECT('name', item_name, 'item_id', item_id, 'location', location_desc, 'color', color, 'description', description, 'image', image_url) AS 'Claimed' FROM Items_found WHERE type = 1");
//sending a response
res.json([[registered], [claimed]]);
});
This is my DataBase but I only want some of the attributes as in the queries above not all of them.
Thank you in advance.