Skip to main content

Connect with Node.js using SSL

To enable SSL connections between SingleStoreDB and Node.js, download the singlestore_bundle.pem certificate file and use it to create the connection.

The following is an example of using the singlestore_bundle.pem certificate file with node-mysql2.

var mysql = require("mysql2");
var fs = require("fs");

var connection = mysql.createConnection({
    host: HELIOS_CLUSTER_HOSTNAME,
    user: 'admin',
    password: HELIOS_ADMIN_PASSWORD,
    ssl: {
        ca: fs.readFileSync(__dirname + '/singlestore_bundle.pem')
    }
});

connection.connect();
connection.end();