[코딩애플][nodeJS] 1주차
새로운 폴더에
1. npm init
package.json 으로 뭐 사용하는지 정리해줌
2. npm install express
express 는 사전같은 거임 , 설치하면 node_module 폴더 안에 책 개많은 폴더 생김
실행시키는 방법은..
3. node server.js
서버 재실행 귀찮음..?
4. npm install -g nodemon
5. nodemon server.js
6. 노드몬 작동 안함? executionpolicy를 파워쉘에 써봐
executionpolicy unrestricted --> y
html 파일을 nodejs로 불러오기
7. res.sendFile(__dirname + '/index.html');
아니.. 쿠키 차단 스크립트를 복붙해서
index.html을 경로에 붙여넣어서 할때는 작동이 안됐는데
우연하게 얻어걸림
작동쓰가 된다링.. 서버에 띄우니까 작동이 되다니 넘나 기분이가 좋은것이었따!!!
8. 포트를 동시에 두개를 띄울 수 있다.
9. 폴더 하위에 html 파일을 불러올 수 있다.
res.sendFile(__dirname + '/public/main.html');