Setting up the Node and Express Backend
Explore how to install Node.js and initialize your project folder for backend development. Learn to set up Express, install key dependencies like CORS, MongoDB driver, and dotenv, and use nodemon for automatic server restarts. This lesson prepares you to build a functional backend for your MERN application.
We'll cover the following...
Node.js installation
Let’s begin by setting up the backend of our application with Node.js and Express.
If you’re setting this up on your local machine, you first need to install Node.js. Go to https://nodejs.org/en/ and download the appropriate version for your operating system.
Note: Installation on your local machine is not required for this course. Everything can be done in the browser terminal.
Installation should be straightforward. Once Node.js has been installed, go to your terminal and run the following command:
$ node -v
This shows the version of Node.js that has been installed.
Creating the back-end folder
In the terminal, create a folder called movie-reviews. Run the following command:
$ mkdir movie-reviews && cd movie-reviews
In the movie-reviews folder, create a folder ...