How to do it...

  1. The first thing we need to do is to create a database, which we will name as blog, and use it:
    CREATE DATABASE blog;    USE blog;
  1. Now that we have our database ready let's work on the MySQL implementation with Node.js. There are many ways to use MySQL with Node, but for this recipe, we will use a package called Sequelize, which is a robust ORM for MySQL and other databases such as SQLite, Postgres, and MsSQL.
  2. The first thing we need to do is to create a config file to add our database configuration (host, database, user, password, etc). To do this, you need to create a file called config/index.js:
  export default {    db: {      dialect: 'mysql', // 'mysql'|'sqlite'|'postgres'|'mssql'      host: 'localhost', // Your host, by default ...

Get React Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.