In this part, we will create our database and write some of the API that will power our application. Now, let's get started!
You will also need to create an account on Cloudinary
connection.js file, populate it with the following code:
The code above handles our database connection parameters.
Next, we create our application entry file
index.js and our environment variable file
.env in our application project root directory. We then populate our
index.js with the following code:
In our entry
index.js file, we imported the
dotenv, and the
cloudinary packages. We also defined our cloudinary configuration parameters (which we will insert later in our
.env variable file). Also, we defined our
500 HTTP response fallback routes, and then, we started our local server on port
.env file, populate the following with your database configuration information and your cloudinary secrete that can be found on your cloudinary dashboard.
Replace all the value positions with your correct database and cloudinary configuration information.
Our MySQL database schema will look like this. If you do not have a suitable MySQL database workbench, you can download MAMP
In this part of the series, we have created our database, populated our
index.js and added our database and cloudinary configuration information.
In the next part, we will be implementing the core API that will power our application.
The source code is also available on GitHub
See you in the next part!