January 2019
Intermediate to advanced
460 pages
10h 33m
English
The first step is to initialize the connection from Sequelize to our MySQL server. To do this, we will create a new folder and file, as follows:
mkdir src/server/databasetouch src/server/database/index.js
Inside of the index.js database, we will establish a connection to our database with Sequelize. Internally, Sequelize relies on the mysql2 package, but we do not use it on our own, which is very convenient:
import Sequelize from 'sequelize';const sequelize = new Sequelize('graphbook_dev', 'devuser', 'PASSWORD', { host: 'localhost', dialect: 'mysql', operatorsAliases: false, pool: { max: 5, min: 0, acquire: 30000, idle: 10000, },});export default sequelize;
As you can see, we require Sequelize from ...
Read now
Unlock full access