Initialize a new Node.js project with default settings.
npm init -y
Install the Express framework.
npm install express
Install nodemon, TypeScript, and type definitions for Express and TypeScript.
npm install nodemon typescript @types/express @types/node -D
Create a tsconfig.json
file to configure TypeScript.
npx tsc --init
Compile the TypeScript code to JavaScript.
npx tsc
Initialize ESLint to maintain code quality.
npm init @eslint/config
Add scripts to the package.json
file for building, starting, and developing the application.
{
"scripts": {
"start": "node dist/app.js",
"build": "tsc",
"dev": "nodemon src/app.ts"
}
}
Start the development server.
npm run dev
This setup covers initializing a Node.js project, installing and configuring Express and TypeScript, setting up ESLint, and adding scripts for development and production builds.