hello world
node.js 프로젝트 생성 본문
1.node.js 프로젝트 생성

1.NODETEST 프로젝트명을 가진 프로젝트 생성

3.index.js 파일 생성

4.index.js 에 아래 코드 작성
var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World~~!\n");
});
server.listen(8000);
console.log("Server running");
4.CMD 창에서 프로젝트가 저장된 경로를 찾는다.


cd 경로
node js파일
찾은 뒤 node index.js 명령어 입력 후 액세스 허용 눌러준다.
짜잔,,,,,

'WEB > Node.js' 카테고리의 다른 글
| Node.js 프레임워크 Express (0) | 2020.08.07 |
|---|---|
| Git Bash 로 node.js 실행 종료 (0) | 2020.08.07 |
| Eclipse 에서 Node.js 개발환경 만들기 (0) | 2020.07.15 |
Comments