본문 바로가기

node10

Node.js - Http Module #### #Node.js - Http Module #### # 참고 - [https://velopert.com/287](https://velopert.com/287) #### # index.html ```html <html> <head> <title>Sample Page</title> </head> <body> Hello World! </body> </html> ``` #### # server.js ```javascript var http = require('http'); var fs = require('fs'); var url = require('url'); // 서버 생성 http.createServer( function (request, response) { // URL 뒤에 있는 디렉토리/파일이름.. 2019. 7. 24.
Node.js - events Module & EventEmitter Class #### # Node.js - events Module & EventEmitter Class - EventEmitter는 Node.JS에 내장 옵저버 패턴의 구현 #### # 참고 - [https://www.haruair.com/blog/3396](https://www.haruair.com/blog/3396) - [nodejs.org : events](https://nodejs.org/dist/v5.5.0/docs/api/events.html) #### # event_emitter.js ```javascript var events = require('events'); var eventEmitter = new events.EventEmitter(); var connectHandler = function c.. 2019. 7. 23.
Node.js-Express ### # Node.js-Express ### # 참고 : https://velopert.com/379 ### # 디렉토리 구조 express_tutorial/ ├── data │ └── user.json ├── node_modules ├── package.json ├── public │ └── css │ └── style.css ├── router │ └── main.js ├── server.js └── views ├── body.ejs ├── header.ejs └── index.ejs ### # 의존 모듈 추가 ``` { "name": "express-tutorial", "version": "1.0.0", "dependencies": { "express": "~4.13.1", "ejs": "~2.4.. 2019. 7. 22.
Node.js #### # 참고 - [https://velopert.com/241](https://velopert.com/241) #### # [Node.js?](https://nodejs.org/ko/) - Chrome V8 JavaScript 엔진으로 빌드된 JavaScript Runtime. - 2009년에 Ryan Dahl에 의해 개발. - 이벤트 기반, 논 블로킹 I/O 모델. - Node.js의 패키지 생태계인 npm은 세계에서 가장 큰 오픈 소스 라이브러리. - 비동기 I/O 처리 . - 빠른 속도 - 단일 쓰레드 / 뛰어난 확장성 - 노 버퍼링 - 라이센스: MIT License #### # REPL (Read Eval Print Loop) - 읽고 값을 계산하고 출력하는 일을 반복하는 행위를 REPL .. 2019. 7. 21.
Virtual DOM 3 # Virtual DOM 3 ##### [source : https://jsfiddle.net/softm/h9e7daqo/](https://jsfiddle.net/softm/h9e7daqo/) ```html RELOAD ``` ```css ``` ```javascript ``` 2019. 7. 12.
Virtual DOM 2 # Virtual DOM 2 ##### [source : https://jsfiddle.net/softm/cgqnzewm/](https://jsfiddle.net/softm/cgqnzewm/) ```html ``` ```javascript /** @jsx h */ function h(type, props, ...children) { return { type, props, children }; } function createElement(node) { if (typeof node === 'string') { return document.createTextNode(node); } const $el = document.createElement(node.type); node.children .map(create.. 2019. 7. 12.