Examples Firebase Connection - mlaanderson/database-js GitHub Wiki
The Firebase driver connects to a Firebase server. The Firebase driver does not support transactions.
Connection URL
firebase://username:password@project_id/root_node?apiKey=API_KEY
The root node is the path to the parent of the entries you define as tables.
The project ID and API key can be found in the Firebase console.
Usage
const Connection = require('database-js2').Connection;
var connection = new Connection('firebase://[email protected]:password@statesdemo/ewJviY6wboTKJ57A2dZkvq8kxYo1?apiKey=AIzaSyD1ypTmnJb_d8ZOyfc-KBMe0tw8owYCwjA')');
Select Some Data
var Connection = require('database-js2').Connection;
(async function() {
let connection, statement, rows;
connection = new Connection('firebase://[email protected]:password@statesdemo/ewJviY6wboTKJ57A2dZkvq8kxYo1?apiKey=AIzaSyD1ypTmnJb_d8ZOyfc-KBMe0tw8owYCwjA');
try {
statement = await connection.prepareStatement("SELECT * FROM states ORDER BY Ranking");
rows = await statement.query();
console.log(rows);
} catch (error) {
console.log(error);
} finally {
await connection.close();
}
})();