I'm building a rest API in node js and want to retrieve data from a query. Now I use this way
app.get('/delete/:key?/:value?', (req, res) => {
let sql = `DELETE FROM data WHERE ${req.query.key}=${req.query.id}`;
db.query(sql, (err, result) => {
res.send(result);
});
});
I want to do something like this
SELECT * FROM data WHERE {key}={value};
The key is taken from the "key" data sent by postman. Example link based on the code above
https://MY_LINK/post?key=1234&value=test
But I want to do something like
https://MY_LINK/post?1234=test
How to get key from postman (in this case is '1234') ??