← Back to Command Library

Node.js

Node.js API Starter (Express)

Initialize npm, install Express stack, and run dev server.

Fast setup for a Node.js backend API.

Version

Node 18+

Tags

nodejs,npm,express,api

Views

3

Problem

Initial script and package setup takes time without a standard template.

Solution Summary

Use this minimal command chain to start development quickly.

Step 1

mkdir api-app && cd api-app
Note: Create and open project directory.

Step 2

npm init -y
Note: Generate package.json.

Step 3

npm install express cors dotenv
Note: Install runtime packages.

Step 4

npm install -D nodemon
Note: Install nodemon for development.

Step 5

npm pkg set scripts.dev="nodemon server.js"
Note: Create dev script in package.json.

Step 6

npm run dev
Note: Run development server.