node.js
-
[node.js] process 객체 더보기programming/node.js 2019. 11. 25. 00:00
process 객체는 argv를 사용할 때도 쓰지만 더 많은 정보를 가지고 있다. 1. process.env node의 환경설정 정보들을 볼 수 있다. ALLUSERSPROFILE, APPDATA, CLASSPATH 등 많은 정보를 가지고 있다. 2. process.env.HOMEPATH env에서 찍힌 정보들 중 선택해서 볼 수 있다. 3. process.versions node에 관련된 버전 정보들을 볼 수 있다. 4. process.versions.node versions 중 node의 버전을 확인할 수 있다. 5. process.uptime() 함수로 정의되어 있기 때문에 호출을 해줘야 한다. node가 시작된 후 실행시간을 반환한다. 더 자세한 정보는 node실행 후 process를 쳐보면 정보..
-
[Node.js] gmail로 이메일 전송하기programming/node.js 2019. 11. 21. 00:00
node.js 이메일 보내기 https://www.w3schools.com/nodejs/nodejs_email.asp Node.js Email Node.js Send an Email The Nodemailer Module The Nodemailer module makes it easy to send emails from your computer. The Nodemailer module can be downloaded and installed using npm: C:\Users\Your Name>npm install nodemailer After you have downloaded the Node www.w3schools.com 해당 튜토리얼을 진행하면 이메일을 보낼 수 있는 방법이 있다. 구글 메일을 사..
-
[node.js] 노드 시작할때 실행 인자 받기programming/node.js 2019. 11. 20. 00:00
실행 인자 받기 시작 시 실행 인자를 받으려면 process.argv로 받을 수 있다. 1 2 3 4 5 6 // node argument.js test1 test2 console.log(process.argv[2]); // test1 console.log(process.argv[3]); // test2 Colored by Color Scripter process.argv process 객체의 argv로 접근하면 시작할 때 뒤에 오는 인자 값들을 순서대로 사용할 수 있다. 1 2 3 4 5 6 7 8 // node argument.js test1 test2 console.log(process.argv[0]); // NODE_PATH\node.exe console.log(process.argv[1]); /..
-
[Node.js] Node.js w3schools Tutorial - Day.3programming/node.js 2019. 11. 19. 00:00
*해당 내용은 https://www.w3schools.com/nodejs/ 의 튜토리얼을 따라 하며 정리하는 글입니다. [Day1] [Day2] What is NPM? NPM은 Node.js를 위한 패키지 매니저다. Node.js가 설치될 때, NPM은 같이 설치된다. node -v로 node.js 버전이 확인 가능하다면(node.js가 설치되었다면) npm -v로 설치된 npm버전도 확인 가능하다(npm도 설치되었다.) Download a Package 설치된 node.js에서 아래 코드를 실행시켜 보자. 1 2 3 var uc = require('upper-case'); console.log(uc("hello world!!")); 모듈을 찾을 수 없다고 뜰 것이다. Error: Cannot find ..
-
[Node.js] Node.js w3schools Tutorial - Day.2programming/node.js 2019. 11. 18. 00:00
*해당 내용은 https://www.w3schools.com/nodejs/ 의 튜토리얼을 따라 하며 정리하는 글입니다. [Day1] 내장 모듈들 노드에는 내장된 모듈이 몇 개 있다. 그중 HTTP 모듈도 있는데, 사용하려면 require() 메소드를 사용하면 된다. var http = require('http'); url 모듈 1 2 3 4 5 6 7 8 9 var http = require('http'); var url = require('url'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); var q = url.parse(req.url, true).query; var txt = q..
-
[Node.js] Node.js w3schools Tutorial - Day.1programming/node.js 2019. 11. 16. 00:00
*해당 내용은 https://www.w3schools.com/nodejs/ 의 튜토리얼을 따라 하며 정리하는 글입니다. Node.js를 공부해야겠다는 생각이 든 것은, 2~3년 전부터 심심할 때마다 구직사이트를 보는데 간간히 보이던 Node.js란 이름이 요즘에는 제법 많은 빈도로 보이게 된 때부터, 공부를 한번 해봐야겠다 생각이 들었다. 그리고 혼자 공부하면 조금 집중력이나, 진도가 느려질 것 같고 블로그에 글을 쓰면서 진행하면 좀 더 열심히 해보지 않을까 해서 글을 올린다. 정말 처음 배우는 입장이라, 잘못된 정보가 있을 수도 있지만 튜토리얼을 따라서 차근차근 진행할 예정이다. 왜 튜토리얼 사이트가 w3schools 이냐면, 그냥 많이 본 사이트라서 그렇다. 좀 더 좋은 Node.js 사이트가 있으면..