Рет қаралды 312
Ссылка на git репозиторий для скачивания:
github.com/bumerboy86/server-...
Создание сервера express typescript на классах
npm init -y
npm install -D typescript tsc-watch ts-node nodemon
npm install -D @types/node @types/express
npm install express dotenv
npm install -D ts-node-dev
npm install cors @types/cors
npx tsc --init
npx tsc
Настройки файла tpackage.json
"dev": "ts-node-dev --respawn --trace-warnings --transpile-only src/index.ts",
Настройки файла tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}