Web/npm
Typescript 기본셋팅
고기상추밥
2019. 1. 12. 12:35
최신버전 확인
npm outdated
모든버전 업데이트
npm update
npm update은 package.json 파일 업데이트 안함
npm update --save 패키지명 추천
명령 프롬프트 킴
cd c:/workspace/
mkdir api1
cd c:/workspace/api1
backend
npm install express mongoose --save
body-parser 는 express안에 기본값으로 이미 포함되있음
그래서 설치 안합니다
개발전용 의존성 추가
npm install @types/node @types/express @types/mongodb @types/mongoose ts-node typescript --save-dev
script 에
"start": "node ./dist/server.js",
"build": "tsc",
"dev": "ts-node ./src/server.ts",
"prod": "npm run build && npm run start"
추가
tsconfig compile option에
"outDir": "./dist"
제일 마제막에 , 한다음에 추가
"include": [
"./src/**/*.ts" //which kind of files to compile
],
"exclude": [
"./node_modules" //which files or directories to ignore
]