npm isntall express mongoose node-mon --save
npm install jest supertest node-mocks-http --save-dev
// typescript 셋팅
npm install ts-node typescript ts-jest
npm install -D @types/express @types/node @types/mongoose @types/jest @types/supertest
{
"compilerOptions": {
"allowJs": true, // 자바스크립트 파일 컴파일 허용 여부
"target": "es6", // 어떤 버전으로 컴파일할지 작성
"module": "commonjs", // 어떤 모듈 방식으로 컴파일할지 설정
"outDir": "./dist", // 컴파일 후 js 파일들이 생성되는 곳
"rootDir": ".", // 루트 폴더 지정
"strict": true, // 모든 엄격한 타입-체킹 옵션 활성화 여부
"moduleResolution": "node", // 모듈 해석 방법 => Node.js
"esModuleInterop": true, // ES6 모듈 사양을 준수하여 CommonJS 모듈을 가져올 수 있게 허용
"skipLibCheck": true, // 정의 파일의 타입 확인을 건너 뛸 지 여부
"resolveJsonModule": true // json data import
},
"include": ["src/*.ts"],
"exclude": ["node_modules, dist"]
}
"scripts": {
"start": "node dist/src/index.js",
"build": "tsc --build",
"dev": "nodemon --exec ts-node src/index.ts"
},
Unit Test( 단위 테스트 )
Integration Test( 통합 테스트 )