수

Node.js란

· 2019-01-09 (수) 20:13:38 · 3031 · 1

Node.js는 오픈 소스 서버 환경입니다.

Node.js를 사용하면 서버에서 JavaScript를 실행할 수 있습니다.

 

 

예제를 통한 학습

우리의 "Show Node.js"도구를 사용하면 Node.js를 쉽게 익힐 수 있으며 코드와 결과가 모두 표시됩니다.

 

var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World!');
}).listen(8080);

 

위 예제를 실행하면 화면에 Hello World!라는 글자가 출력되게 됩니다.

 

명령 줄 인터페이스에서 실행되는 예제

이 자습서에서는 명령 줄 인터페이스에 결과를 표시하여 더 잘 설명 할 수있는 몇 가지 예제가 있습니다.

이 경우 "Show Node.js"도구는 결과를 오른쪽에 검은 색 화면으로 표시합니다.

 

console.log('This example is different!');
console.log('The result is displayed in the Command Line Interface');

 

 

Node.js에는 추가 설치없이 사용할 수있는 내장 모듈 세트가 있습니다.

다음은 Node.js 버전 6.10.3의 내장 모듈 목록입니다.

 

Module Description
assert Provides a set of assertion tests
buffer To handle binary data
child_process To run a child process
cluster To split a single Node process into multiple processes
crypto To handle OpenSSL cryptographic functions
dgram Provides implementation of UDP datagram sockets
dns To do DNS lookups and name resolution functions
domain Deprecated. To handle unhandled errors
events To handle events
fs To handle the file system
http To make Node.js act as an HTTP server
https To make Node.js act as an HTTPS server.
net To create servers and clients
os Provides information about the operation system
path To handle file paths
punycode Deprecated. A character encoding scheme
querystring To handle URL query strings
readline To handle readable streams one line at the time
stream To handle streaming data
string_decoder To decode buffer objects into strings
timers To execute a function after a given number of milliseconds
tls To implement TLS and SSL protocols
tty Provides classes used by a text terminal
url To parse URL strings
util To access utility functions
v8 To access information about V8 (the JavaScript engine)
vm To compile JavaScript code in a virtual machine
zlib To compress or decompress files
|

댓글 1개

2019-01-18 (금) 00:07:41
node node node ㅎㅎㅎㅎ!
감사합니다
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
node.js 19-01-11 조회 2,909
node.js 19-01-10 조회 2,592
node.js 19-01-10 조회 2,691
node.js 19-01-10 조회 2,420
node.js 19-01-09 조회 2,646
node.js 19-01-09 조회 2,806
node.js 19-01-09 조회 3,032
웹서버 19-01-04 조회 3,533
PHP 18-12-18 조회 2,850
웹서버 18-12-07 조회 2,462
JavaScript 18-12-06 조회 3,209
node.js 18-11-29 조회 4,318
기타 18-11-20 조회 4,864
기타 18-11-19 조회 2,884
기타 18-11-19 조회 2,587
기타 18-11-19 조회 2,644
Mobile 18-11-09 조회 2,865
JavaScript 18-11-08 조회 2,880
기타 18-11-08 조회 2,878
jQuery 18-11-06 조회 3,118
PHP 18-10-31 조회 5,912
jQuery 18-10-29 조회 5,774
기타 18-10-12 조회 3,360
MySQL 18-10-11 조회 4,750
기타 18-10-11 조회 2,838
웹서버 18-10-07 조회 3,064
MySQL 18-10-04 조회 2,850
MySQL 18-10-02 조회 3,321
JavaScript 18-10-02 조회 1.1만
웹서버 18-09-29 조회 2,985