Setup
Environment Variables

Environment variables are used to store sensitive data such as passwords, API credentials, and other information that should not be written directly in code. Environment variables must be used to configure any variables or configuration details that may differ between environments.

Create a .env.local file in your root folder if it isn't created already and put in it our API endpoint like so:

API_ENDPOINT=https://moroccan-events-api.glitch.me/

If you have git installed, in you IDE you will see that this file is not tracked because it was added to .gitignore by default in the nextjs installation

// your .gitignore file
...
...
...
# local env files
.env*.local

We are going to refer to this .env file in our next chapters and maybe add more variables to it, so make sure you have it!