So I have been working on a web app with local mysql workbench. I recently moved the database to Azure Database for MySQL. Everything was working properly before I moved away from local. All my webpages were working properly, now only 2 out of the 4 pages work and I am running into the error below when I click on the broken pages. Below is how I am connecting to the database, I am not sure if the second connection is working.
Do I need to do something like this?
https://learn.microsoft.com/en-us/azure/mysql/howto-configure-ssl
Thank you for any help!
var connection = mysql.createConnection({
host: 'host',
user: 'user',
password: "password",
database: 'schema_1',
ssl: true
});
var connection = mysql.createConnection({
host: 'host',
user: 'user',
password: "password",
database: 'schema_2',
ssl: true
});
EDIT HERE ------------------------
table_routes.js
var express = require('express')
, http = require('http')
, mysql = require('mysql'); // <---- HERE
var app = express();
const fs = require('fs');
const path = require('path');
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "http://127.0.0.1:3000");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
var connection = mysql.createConnection({
host: 'host',
user: 'root',
password: "password",
database: 'db1',
ssl: {
ca: fs.readFileSync(path.resolve(__dirname, 'BaltimoreCyberTrustRoot.crt.pem'))
}
});
connection.connect(); // <---- AND HERE
// all environments
app.set('port', process.env.PORT || 7003);
table_routes2.js
var express = require('express')
, http = require('http')
, mysql = require('mysql'); // <---- HERE
var app = express();
const fs = require('fs');
const path = require('path');
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "http://127.0.0.1:3000");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
var connection = mysql.createConnection({
host: 'host',
user: 'user',
password: "password",
database: 'db2',
ssl: {
ca: fs.readFileSync(path.resolve(__dirname, 'BaltimoreCyberTrustRoot.crt.pem'))
}
});
connection.connect(); // <---- AND HERE
// all environments
app.set('port', process.env.PORT || 7004);