Connecting a FeathersJS app with the Database | MySQL | FeathersJS Series | Part - 2
In Part - 1 of the series we saw how to create a new feathers app.
In this tutorial, we will see how to connect our feathers app with a Database.
We will be connecting our app with MySQL here, but we can use other databases such as MongoDB too.
The first step is to create a database. For this, we will use the MySQL client to create a database.
For most MySQL databases, the username is "root", the host is "localhost" and port is "3306". You also need to know your MySQL password for user "root".
We need to declare all these variables in our configuration files. Because we are working in a local environment we'll declare these variables inside default.json.
After we have declared these variables in our configuration file, we will import them in the sequelize.js file to create the database connection.
Okay, so we have imported the values.
Let's run our server and check if the connection has been made.
So, the server ran without any error, which shows that our connection has been established.
In Part - 3 of the series we'll see how to create services in FeathersJS and how to manage them.