- Node.js Express는 Node를 웹서버와 연동시켜주는 Web Server Framework이다. 쿠키, 세션, 로그기록, 라우팅 등의 기능들을 소화할 수 있으며 다른 모듈들과 쉽게 연결할 수 있다는 장점이 있다.
- 작업할 폴더를 생성 후 cmd 창을 열어 Express NPM을 설치.
1-1) npm install express-generator –g
- 여기서 –g는 해당 폴더에 전역적으로 express를 설치하겠다는 명령어이다.
1-2) express –-view=jade myapp
- express를 설치 후 Express 폴더 구조를 생성.
- jade는 express에서 제공하는 View 템플릿을 말한다. Express 템플릿은 여러 개의 종류가 있다
- myapp은 프로젝트 이름을 뜻한다.
- node Express가 생성되었지만 아직 필요한 NPM 모듈이 설치되지 않았다. myapp 폴더 경로에 이동 후 npm install을 실행.
1-3) cd myapp
1-4) npm install
1-5) npm start
- 설치가 완료 되고 서버를 실행시킨 후 http://localhost:3000/로 접속해본다.
- 해당 페이지가 나온다면 node Express는 성공적으로 설치 되었다.
- 참고 URL: https://expressjs.com/ko/starter/generator.html
- Express 메서드 및 사용 가이드 URL: http://expressjs.com/en/4x/api.html#express
'Node.js' 카테고리의 다른 글
[Node.js Oracle 연동] Node Express 서버에 Oracle DataBase 연동하기 (1) | 2019.07.12 |
---|---|
Node.js 설치 방법 (Window 64Bit) (0) | 2019.06.07 |