From the course: Databases for Node.js Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use Node.js with MySQL

Use Node.js with MySQL

From the course: Databases for Node.js Developers

Start my 1-month free trial

Use Node.js with MySQL

- As you may have guessed I'm now back at my maxcoin sample application and also in this maxcoin directory on my console in like for MongoDB and redis I now also have to install a driver and I will use mysql2 for that. There is also regular mysql package but mysql2 is a little bit more modern. For instance, it's a puts promises. So now type mysql, npm install mysql2. This will pull down the driver and I can already open my main js file and they will now bring in the mysql backend because the file already exists but we have to implement it still. So copy this line here for the RedisBackened and just rename it to MySQLBackened and I also have to change the pass here to MySQLBackend and then I have to create this connection functions so I will simply copy, runRedis and call it runMySQL and of course want to have the mySQLBackend here and for that I have to do new MySQLBackend, and then in the end I the call…

Contents