1.nodemon 설치
$npm install nodemon --save-dev
2. concurrently 설치
npm i concurrently
3. npm run dev 한줄 명령어로 api 서버와 프론트 서버 동시 구동 설정 예
1)
"scripts": {
"devStart": "nodemon server.js",
"devStartAuth": "nodemon authServer.js",
"dev": "concurrently \"npm run devStartAuth \" \"npm run devStart\" ",
"test": "echo \"Error: no test specified\" && exit 1"
},
2) 디렉토리가 다른 경우
"scripts": {
"start": "NODE_ENV=production node index.js",
"backend": "NODE_ENV=development nodemon index.js",
"frontend": "npm run front --prefix ../client",
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "concurrently \"npm run backend\" \"npm run start --prefix ../client\""
},
4. hbs. 등 기타 UI 템플릿이 nodemon watch 적용 예
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "nodemon ./app.js -e js,json,mjs,hbs"
},














댓글 ( 4)
댓글 남기기