https://nodejs.org/ko/download/
버전 확인
$ node --v
$ node--version
노드 설치될때 보통 같이 자동으로 설치가 된다.
https://www.npmjs.com/
npm은 Node package manager의 약자
개발자들이 패키지(모듈)의 설치 및 관리를 쉽게 하기 위해 도와주는 매니저(관리 도구)
$ npm version
$ npm help npm
$ npm init
$ npm i express # -g
$ npm i nodemon -D # devDependencies
$ npm list
$ npm show express
$ npm outdated
$ npm update # wanted 까지 업데이트 됨
$ npm start # run scripts.start in package.json
$ npm run dev
npm install
node_modules라는 폴더가 생기고, package.json파일에 모듈이 dependencies에 추가됨!
1) 패키지명을 명시해 특정 패키지를 설치
npm install + 패키지명 (npm i + 패키지명)
2) 패키지명을 명시하지 않고 package.json 파일의 의존성을 설치하는 동작
패키지명을 입력하지 않고 npm install(npm i)만 입력할 시 package.json의 "dependencies"객체에 명시되어 있는 패키지(모듈)들을 모두 설치하게 된다.
-D : devDependencies
-g : glo
별도의 설치없이 바로 사용가능
dirname, filename
//Running node example.js from /Users/mjr
console.log(__filename);
// Prints: /Users/mjr/example.js
console.log(__dirname);
// Prints: /Users/mjr
http, crypto, url, path, querystring, fs 등 다양한 모듈이 있다.
http 모듈은 Node.js에서 HTTP를 통해 데이터를 전송할 수 있도록 하는 모듈
fs 모듈은 file system을 가리킵니다. 파일의 CRUD(생성, 조회, 수정, 삭제) 및 디렉토리 읽기 등이 가능
module을 어떻게 불러와서 쓰고 어떻게 내가 만들어서 사용할 수 있을까?
이후에 포스팅 예정,,
🫢 시작할때 환경설정 부분이 가장 헷갈렸는데 이렇게 깔-끔하게 정리해주시다니..! 감사합니다!!