node-firebird
node-firebird copied to clipboard
Cant get a data(POSTMAN)
Hi everyone... i`m so sorry. but i need help. When i get data from DB, i can print result on console.log. But when i trying return data i get emty.
If you can help me. What is a problem? Thx a lot...
.
That code is right!
`app.use((req, res) => {
firebird.attach(OPTIONS, function (err, db) {
if (err)
throw err;
// db = DATABASE
db.query('SELECT * FROM spr_abon s where s.nom_abon = 35 and s.id_region = 39', function (err, result) {
db.detach();
res.setHeader('content-type', 'application/json');
res.send(JSON.stringify(result))
res.end()
});
}
)
})`
Hi @LabelMinsk This issue is resolved. Please close it.
Btw, use: res.json(result) // same res.setHeader(...) & res.send(JSON.stringify(result))