Node.js :: Berlioz Documentation

Node.js

Initialize

Install Berlioz SDK:

$ npm install --save berlioz-sdk berlioz-gcp

Connecting to SQL Database

const berlioz = require('berlioz-sdk');
berlioz.addon(require('berlioz-gcp'));

const connection = berlioz.database('<name>').client('mysql', {
    user: '<user>',
    password: '<pass>',
    database: '<db-name>'
});

Making Queries

connection.query('SELECT * FROM books;')
    .then(result => {
        console.log(result);
    })