const express = require('express');
const Firebird = require('node-firebird');
const app = express();
const port = 3000;
const options = {
host: 'localhost',
database: '/path/to/your/database.fdb',
user: 'your_username',
password: 'your_password'
};
app.get('/data', (req, res) => {
Firebird.attach(options, (err, db) => {
if (err) {
console.error(err.message);
return;
}
db.query('SELECT * FROM your_table', (err, result) => {
if (err) {
console.error(err.message);
db.detach();
return;
}
res.json(result);
db.detach();
});
});
});
app.listen(port, () => {
console.log(`Server listening at http://localhost:${port}`);
});
It's connecting, but it doesn't return anything in the query. If I write something wrong in the query, an error returns, but if I write it right the query doesn't return anything. I looked a lot about it, I think it's because I'm using Firebird 1.5, but I can't change the version of Firebird.