Getting started with express.js

how to set up a dev environment for express.js

Photo by Ethan McArthur on Unsplash

To begin, make a backend folder that will host your repository then create a git repo from here.

  1. npm init -y

from here we’ll have a lot of the tech that will be necessary to begin the development of a restful express backend API.

Here's a brief explanation of what each package does:

  1. express: a lightweight backend framework for node.js

At this point you have access to what you need in order to get started working with the express, you just need the basic server.js file and require mongoose and express shown below

you’re then going to want to create a .env file and make a variable that is called ATLAS_URI and is assigned the URI given to you by MongoDB
make sure to change the password field to the password you chose when initializing your MongoDB server.

ATLAS_URI-URIHERE<password>

from here to test your server you can install another dependency called nodemon with:”>npm install nodemon” then running the command with

“nodemon server.js”

within your terminal.

Software engineer, Graduate of Flatiron school. Currently volunteering! Looking to talk to fellow engineers, please send me a message!