EZFUNLAB 번역버튼
🌐

Node.js 설치

다운로드
https://nodejs.org/ko
필요에 따라 아래링크 설치
https://nodejs.org/ko/download/

설치 확인
cmd > node -v


npm 사용 가능
경로 예시

d:\test_web
npm init
(package.json 없을시 생성)

npm install


index.js (파일 만들기)

파일 내용
const http = require(‘http’);
const server = http.createServer((req, res) => {
res.writeHead(200, {‘Content-Type’: ‘text/html; charset=utf-8’});
res.write(‘node.js test server!’);
res.end();
});
server.listen(3000, () => {
console.log(‘서버가 3000번 포트에서 실행 중입니다.’);
});

node index.js
서버가 3000번 포트에서 실행 중입니다.

웹브라우져
localhodt:3000
확인



react 연동하기
npx create-react-app my-app

cd my-app

npm start