Beginner Dev Documentation: Node.js RESTful API with Mongoose

The Tools Used

  1. VS Code
  2. Node. js
  3. Postman

Initial Folder and File Setup

  1. backend folder : This contains all backend related files and folders
  2. .env file : Also described as Environment Variables file, usually contains key or variable that has secret value
  3. .gitignore file : List of files or folders that going to be ignored to be pushed to Git. For example node_modules folder

Initial Step

npm init
{"name": "mern-tutorial","version": "1.0.0","description": "","main": "server.js","scripts": {"test": "echo \"Error: no test specified\" && exit 1",},"author": "","license": "ISC",}

Initial Packages

npm i express dotenv mongoose colors express-async-handler
npm i -D nodemon

Additional Changes to Run Script

npm run server

The REST of The File Structure

Database Setup

Schema Setup

The REST

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store