Connect to a MySQL Database

Connect to a MySQL database and run dynamic scripts through that library. The library is responsible for connecting to the database, executing the script and closing the connection after execution.

const mysql = require('linkapi-sdk/state/mysql');

const config = {
  credentials: {
    "host": "",
    "username": "",
    "password": "",
    "port": "",
    "database": "",
  }
}

const query = 'SELECT * FROM {{table}}';

const queryValues = {
  table: 'PRODUCTS'
};

const result = await mysql.execute(config);