https://github.com/jokj624/node-typescript-init
jokj624/node-typescript-init
nodejs express mongoDB typescript 초기 개발 환경 구축 . Contribute to jokj624/node-typescript-init development by creating an account on GitHub.
github.com
나는 초기 설정 맨날 까먹어서 . . . 솝커톤 때 허둥지둥 할까봐 세미나때 배운 내용 그대로 미리 레포로 파뒀다.
.env 파일만 만들어 놓고, 실행시키면 로컬 서버 실행과 몽고디비 연결이 되게끔 설정 했다.
tfconfig.json
{
"compilerOptions": {
"target": "es6",
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"moduleResolution": "node",
"module": "commonjs",
"pretty": true,
"sourceMap": true,
"outDir": "./dist",
"allowJs": true,
"noEmit": false,
"esModuleInterop": true,
"typeRoots": ["./src/types/express.d.ts", "./node_modules/@types"]
},
"include": ["./src/**/*"],
"exclude": ["node_modules", "tests"]
}
package.json
{
"name": "soptkathon",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "ts-node src",
"build": "tsc && node dist"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/express": "^4.17.11",
"@types/mongoose": "^5.10.5",
"@types/node": "^15.6.0",
"ts-node": "^9.1.1",
"typescript": "^4.2.4"
},
"dependencies": {
"dotenv": "^9.0.2",
"express": "^4.17.1",
"mongoose": "^5.12.10"
}
}
처음부터 하려면
npm init
npm install --global yarn
yarn add typescript ts-node --dev
yarn add @types/node --dev
tsc --init
tsconfig.json 설정
'DEV > Node.js' 카테고리의 다른 글
[CI/CD] AWS CodeDeploy, CodePipeline 으로 node.js, ec2, git 배포 자동화하기 (4) | 2021.12.16 |
---|---|
[Node.js] Express, TypeScript, MongoDB 회원가입 (1) (3) | 2021.06.18 |
Node.js + Koa + Typescript 로 슬랙 봇 개발해보기 (1) (0) | 2021.04.19 |
Node js + Express + Socket.io 로 1대 1 채팅 구현하기 (1) (4) | 2021.03.14 |
React, Mongoose(MongoDB), Node js 게시판 검색 구현 (2) | 2021.03.13 |