리자

책 따라 하면서 web server 구동 성공했네요.

server.js 

-------------------------------------------------------

var http = require('http'); 

http.createServer( function(request, response) {

  response.writeHead(200, {'Content-Type': 'text/html'});

  response.end('<h1>Hello Web Server with Node.js</h1>');

}).listen(8080, function() {

  console.log('Server running at :8080');

});




$ node server.js 실행
Server running at :8080



// 8080 포트 풀고
# iptables -I INPUT -p tcp --dport 8080 -j ACCEPT 



// 브라우저에서 실행하니

Hello Web Server with Node.js



나오네요. ^^
|

댓글 1개

Hello world 처음 찍어내는 그 기쁨입니다.
댓글을 작성하시려면 로그인이 필요합니다.

Node.js

+
제목 글쓴이 날짜 조회
10년 전 조회 2,707
10년 전 조회 2,733
10년 전 조회 7,249
10년 전 조회 2,591
10년 전 조회 2,425
10년 전 조회 2,253
10년 전 조회 3,976
10년 전 조회 2,640
10년 전 조회 2,561
10년 전 조회 2,196
10년 전 조회 3,272
10년 전 조회 2,100
10년 전 조회 2,685
10년 전 조회 2,906
10년 전 조회 2,185
10년 전 조회 2,427
10년 전 조회 2,004
10년 전 조회 2,268
10년 전 조회 2,608
10년 전 조회 1,664
10년 전 조회 1,759
10년 전 조회 1,693
10년 전 조회 1,590
10년 전 조회 1,625
10년 전 조회 1,521
10년 전 조회 1,547
10년 전 조회 1,414
10년 전 조회 1,394
10년 전 조회 1,843
10년 전 조회 1,629