01. The Foundation

Every Lego castle needs a base plate. This starter kit gives you a production-ready Express server with MongoDB connection, security middleware, and error handling pre-configured.

Initialize Project

Open your terminal and run these commands to set up your project folder and install dependencies.

Terminalbash
1# Create directory
2mkdir my-api
3cd my-api
4
5# Initialize npm
6npm init -y
7
8# Install dependencies
9npm install express mongoose dotenv cors helmet xss-clean hpp express-mongo-sanitize morgan colors
10npm install -D nodemon