과 같은 다른 npm 스크립트가 http-server
으로 HTTP 요청을 만들 수 있도록 npm 스크립트에서 백그라운드로 http-server
을 시작하려면 어떻게해야합니까?npm 스크립트에서 백그라운드로 http- 서버 실행
npm install http-server --save-dev
package.json
파일이 포함되어 있습니다 :
"scripts": {
"pretest": "gulp build-httpdocs",
"test": "http-server -p 7777 httpdocs/ && mocha spec.js"
},
npm test
실행이 성공적으로 http-server
시작하지만, 물론 명령이 중단 보여주는 후 :
Starting up http-server, serving httpdocs/
Available on:
http://127.0.0.1:7777
http://192.168.1.64:7777
Hit CTRL-C to stop the server
http-server
패키지와 함께 설치
Mocha 테스트를 차단하지 않도록 웹 서버를 시작할 수있는 쉬운 방법이 있습니까?
보너스 : 모카 테스트를 실행 한 후 어떻게 http-server
을 종료합니까?
check https://stackoverflow.com/questions/26456618/deploy-node-app-with-http-server-and-forever –
@IleshPatel 해당 질문에 대답이없고 npm 스크립트에는 적용되지 않습니다. . –
당신은 linux/mac이나 windows에 있습니까? –