리자

책 따라 하면서 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,654
10년 전 조회 2,677
10년 전 조회 7,190
10년 전 조회 2,541
10년 전 조회 2,378
10년 전 조회 2,208
10년 전 조회 3,926
10년 전 조회 2,600
10년 전 조회 2,508
10년 전 조회 2,156
10년 전 조회 3,231
10년 전 조회 2,057
10년 전 조회 2,637
10년 전 조회 2,860
10년 전 조회 2,140
10년 전 조회 2,356
10년 전 조회 1,947
10년 전 조회 2,230
10년 전 조회 2,551
10년 전 조회 1,614
10년 전 조회 1,706
10년 전 조회 1,647
10년 전 조회 1,540
10년 전 조회 1,569
10년 전 조회 1,467
10년 전 조회 1,494
10년 전 조회 1,356
10년 전 조회 1,335
10년 전 조회 1,783
10년 전 조회 1,578