Search
▪️

Introduction

Node.js 특징

Node.js는 Runtime JavaScrip이다.
JavaScript지만 다른 버전의 JavaScript라고 보면 된다. 보통 JavaScript는 Browser에서 동작하지만 Node.js는 Browser외에 다른 기기에서도 작동할 수 있도록 만들어졌다. 즉, 서버를 구성하는데 사용할 수 있다는 소리이다.
Node.js는 V8이라는 엔진을 사용하는데 해당 엔진은 C++로 만들어져서 기계어로 변환해주는 역할을 한다.
따라서 Node.js는 C++에 JavaScript 특징을 더하여 엔진에 의해 기계어로 변환하여 명령어들을 처리한다.
Node.js v12.16.1 to /usr/local/bin/node
npm v6.13.4 to /usr/local/bin/npm
fs를 require 하면 파일 시스템 라이브러리에 접근하여 해당 라이브러리의 method를 이용할 수 있다.
fs.writeFileSync(...)처럼 파일을 생성하는 것 역시 가능하다.
서버 사이드 코드를 작성하여 서버를 구동하기 위해서 Node.js를 이용하는 것이 일반적이다.
서버는 JavaScript, HTML, CSS로 만들어진 Browser Client에게 Request를 받으면 이 Client에게 HTML Page Response를 보낸다. 이 때, 서버가 작업하는 것들은 Database와 Interaction, Input Validation, Authentication, Business Logic들을 처리한다. (서버로의 Direct한 접근은 불가능하다.)
Node.js는 JavaScript Runtime이기 때문에 Utility Scripts나 Build Tools 등... 서버 사이드 코드 이상으로 이용할 수 있다.

Node.js의 역할

Run Server: Create Server & Listen t Incoming Requests
Business Logic: Handle Requests, Validate Input, Connect to Database
Responses: Return Responses (Rendered HTML, JSON)

Alternatives of Node.js

1.
Flask, Django of Python
2.
php
3.
Ruby on Rails
4.
ASP.NET
5.
ETC

Course Outline

1.
Getting Started
2.
JavaScript Refresher
3.
Node.js Basics
4.
Efficient Development
5.
Using Express.js
6.
Templating Engines
7.
MVC (Model-View_Controller) Pattern
8.
Advanced Routes & Models
9.
Node + SQL (MySQL)
10.
Using Sequelize
11.
Node + NoSQL (MongoDB)
12.
Using Mongoose
13.
Sessions & Cookies
14.
Authentication
15.
Sending E-Mails
16.
Authentication Deep Dive
17.
User Input Validation
18.
Error Handling
19.
File Uploads & Downloads
20.
Pagination
21.
Async Requests
22.
Handling Payments
23.
REST API Basics
24.
Advanced REST API Features
25.
Using async-await
26.
Websockets & Socket.io
27.
GraphQL
28.
Deployment
29.
Beyond Web Servers
30.
Roundup & Next Steps

Execute Files vs Use the REPL

Execute Files: Used for real apps, Predictable sequence of steps
Use the REPL: Great playground, Execute code as you write it
** The REPL (Read / Evaluate / Print / Loop) is supported by node command