The purpose of this task is to connect our express backend to a database.
You have 2 options - SQLite or MongoDB Atlas.
SQLite is lightweight, does not requiring a server and is basically a file based db.
MongoDB Atlas is a powerful db in the cloud. It has free tier which you could use for this tutorial.
Check their docs and setup with express than decide which one you want to use.
We can discuss pros and cons together.
Make sure to store the connection string under .env file.
Use a package called dotenv in order to load Environment variables from .env.
After you have a setup of the db, we'll continue with business logic.
The purpose of this task is to connect our express backend to a database.
You have 2 options - SQLite or MongoDB Atlas. SQLite is lightweight, does not requiring a server and is basically a file based db. MongoDB Atlas is a powerful db in the cloud. It has free tier which you could use for this tutorial.
Check their docs and setup with express than decide which one you want to use. We can discuss pros and cons together.
Make sure to store the connection string under
.env
file. Use a package calleddotenv
in order to load Environment variables from.env
.After you have a setup of the db, we'll continue with business logic.