Follow these steps to create and set up your project:
-
Initialize a new Node.js project:
npm init -y
-
Install TypeScript as a development dependency:
npm install -D typescript
-
Create a TypeScript configuration file:
npx tsc --init
-
Install Express using pnpm:
pnpm i express
-
Install Express type definitions for better editor support:
pnpm i @types/express
-
Update the
tsconfig.json
file to set customoutDir
androotDir
: - Opentsconfig.json
and modify/add the following options:json { "compilerOptions": { "outDir": "./dist", "rootDir": "./src" } }
-
Create the corresponding folders for your source and output files:
bash mkdir src dist