Encountered the trouble of configuring MYSQL and node.js
<p><br /></p>
<pre class="brush:php;toolbar:false;">const Sequelize = require("sequelize");
require("dotenv").config();
const sequelize = new Sequelize(
process.env.DB_NAME,
process.env.DB_USER,
process.env.DB_PASSWORD,
{
host: "localhost",
dialect: "mysql",
port: 3306,
dialectOptions: {
socketPath: "/tmp/mysql.sock",
},
}
);
module.exports = sequelize;</pre>
<p>I'm at a coding bootcamp and we're working on a group project and I ran into a bug</p>
<p><code>connect ENOENT /tmp/mysql.sock</code></p>
<p>My instructor told us that this code is for Mac users, and I am using Windows.
Is there a way to write a conditional statement that ignores this code if running on Windows, but runs it when running on Mac?
I searched online and found nothing. So I had to comment it out locally, and while that worked, there had to be a better way. </p><p><br /></p>