노드는 Chrome V8 엔진으로 만들어진 자바스크립트 런타임이다.
여기서 V8은 자바스크립트를 기계어로 컴파일 해주는 것을 뜻하며 런타임이란 프로그래밍 언어가 구동되고 있는 환경을 뜻한다.
=> 자바스크립트를 컴파일 해주는 엔진으로 빌드 된 자바스크립트가 구동중인 환경이다.
유저의 클릭이나 네트워크에 리소스를 요청하는 이벤트가 논블로킹으로 이루어지는 Input Output model이다.
node와 함께 번들링 되어있는 모듈로, require('') 방식으로 사용할 수 있다.
ex1) fs, http, url, path
ex2)
const fs = require('fs')
const http = require('http')
fs.readFile('./something.json',(err,data)=>{
console.log(data);
})
http.get('http://localhost:5000/api',(res)=>{
console.log(res)
})
풀네임은 Node Package Manager.
세계에서 가장 큰 오픈소스 라이브러리 생태계 중 하나
ex)
before
<html>
<head>
<script src="https://code.jquery.com/jquery-2.x-git.min.js"></script>
</head>
<body>
<script>
$('button').on('click',function () {})
</script>
</body>
</html>
after
const $ = require('jqery')
$('button').on('click',function() {
console.log('button clicked!!!')
})
그리고 package.json에 그 정보들이 모두 담겨있다.
{
"name": "hello",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"jquery": "^3.3.1"
}
}