티스토리 뷰

Programming/Node.js

Node.js - Windows에 설치

파란크리스마스 2017. 7. 9. 19:13
728x90

출처 : [nodejs] 윈도우에서 node.js 설치 및 실행하기 - 워크식스 블로그

PATH에 추가

C:\server\node-v6.11.2-win-x64

Hello world

C:\> node
>
(To exit, press ^C again or type .exit)
> console.log('hello world!')
hello world!
undefined

웹서비스

// 모듈을 추출합니다.
var http = require('http');

// 웹 서버를 만들고 실행합니다.
http.createServer(function (request, response) {
  response.writeHead(200, { 'Content-Type': 'text/html' });
  response.end('<h1>Hello World!</h1>');
}).listen(80, function () {
  console.log('Server running at http://127.0.0.1/');
});

실행

C:\> node http_test.js
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함