1. expres-first 디렉토리 생성
2. 프로젝트 파일 생성
~/Projects/NodeJS/express-first$ npm init -y
Wrote to /home/mhchae3/Projects/NodeJS/express-first/package.json:
package.json 파일이 생성되는데, 패키지 의존성 관리를 한다.
3. app.js 파일 생성. 보통 진입점으로 잡음.
const express = require('express')
4. app.js 파일 생성. 보통 진입점으로 잡음.
5. 레포지토리 검색
-> npmjs 사이트에서 검색 가능함
5. express 설치
~/Projects/NodeJS/express-first$ npm i express
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN express-first@1.0.0 No description
npm WARN express-first@1.0.0 No repository field.
+ express@4.17.1
added 50 packages from 37 contributors and audited 50 packages in 3.933s
found 0 vulnerabilities
6. node_modules 디렉토리가 추가된것을 확인할 수 있다.
~/Projects/NodeJS/express-first$ ls -l
합계 28
-rw-rw-r-- 1 mhchae3 mhchae3 37 6월 16 15:32 app.js
drwxr-xr-x 52 mhchae3 mhchae3 4096 6월 16 15:38 node_modules
-rw-r--r-- 1 mhchae3 mhchae3 14350 6월 16 15:38 package-lock.json
-rw-r--r-- 1 mhchae3 mhchae3 277 6월 16 15:38 package.json
7. package-lock.json 파일도 생긴다. 수정하면 안되는 파일.
~/Projects/NodeJS/express-first$ ls -l
합계 28
-rw-rw-r-- 1 mhchae3 mhchae3 37 6월 16 15:32 app.js
drwxr-xr-x 52 mhchae3 mhchae3 4096 6월 16 15:38 node_modules
-rw-r--r-- 1 mhchae3 mhchae3 14350 6월 16 15:38 package-lock.json
-rw-r--r-- 1 mhchae3 mhchae3 277 6월 16 15:38 package.json
8. package.json 파일이 자동 수정됨. dependecies 항목이 생김
"dependencies": {
"express": "^4.17.1"
}
9. 공유시 package.json과 소스파일만 공유하면, dependecies 항목을 보고 필요한 모듈을 설치해준다.
10. 시멘틱 버저닝
의미 : 버전을 3자리로 관리하는것.
'IT > JavaScript와 Framework' 카테고리의 다른 글
express 프레임웍 샘플 2 - 클라이언트 요청받아 응답받기 (0) | 2021.06.16 |
---|---|
express 프레임 웍 사용예제 (0) | 2021.06.16 |
npm 간단한 사용법 (0) | 2021.06.15 |
Visual Studio Code 를 사용한 개발환경 설정, 실행, 디버깅 Code runner (0) | 2021.06.15 |
우분투에 Node.js 14.17.0 설치하기 (0) | 2021.06.14 |
댓글