[2]node.js 개발 환경 구축

Download Report

Transcript [2]node.js 개발 환경 구축

node.js 개발 환경 구축
ㅇ node.js 설치
- http://nodejs.org 접속
- 설치경로 : C:\nodejs
node.js 개발 환경 구축
ㅇ node.js 실행 및 스크립트 작성
- 명령 프롬프트
node.js 개발 환경 구축
ㅇ NPM (Node Package Manager)
- 서드파티 패키지 중앙 저장소
- 설치된 패키지 관리
- 다른 패키지에 있는 의존성을 정의하는 표준
ㅇ Express 모듈 설치
- Error: ENOENT, stat ‘C:\Users\[UserName]\AppData\Roaming\npm’
에러 출력시 위 경로의 npm 폴더를 생성 후 재시도
node.js 개발 환경 구축
ㅇ Express 모듈 설치 결과
- 설치된 express 모듈의 버전과 의존성이 있는 모듈이 함께 설치된 결과를 보여줌
node.js 개발 환경 구축
ㅇ Express 모듈 삭제
ㅇ NPM 모듈 검색
- https://npmjs.org 접속 후 패키지 검색
node.js 개발 환경 구축
ㅇ Eclipse 플러그인 설치
node.js 개발 환경 구축
ㅇ Eclipse 플러그인 설치
node.js 개발 환경 구축
ㅇ Eclipse 플러그인 설치
- Workspace 지정 : [node.js경로]/workspace
- Eclipse - [Window] – [Nodeclipse]
node.js 개발 환경 구축
ㅇ 샘플 프로젝트
- Project Explorer - [New] - [Node Project]
node.js 개발 환경 구축
ㅇ 샘플 프로젝트
- server.js 생성
var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type' : 'text/plain'});
res.end('Hello World\n');
}).listen(3000);
console.log('Server running at http://127.0.0.1:3000');
node.js 개발 환경 구축
ㅇ 샘플 프로젝트
- server.js 실행
[Run As] - [Node Application] or [Ctrl] + [F11]
- 브라우저 접속