...

/

Connect to the MySQL Database

Connect to the MySQL Database

Learn how to connect the REST API application to the MySQL database.

Introduction

The storage used so far is not persistent, and the authentication feature has not been available. Let’s replace it with persistent storage using the MySQL database and add the authentication feature using the JSON Web Tokens (JWT) mechanism.

Before implementing those features, some additional libraries are added:

Before implementing those features, some additional libraries are added:

  • GORM: For object-relational mapping mechanism to the relational database.
  • GoDotEnv: For reading .env files.
  • JWT: For authentication mechanism.
  • Bcrypt: For password encryption.

We ...