node.js 공부 정리
const fs = require("fs"); fs 모듈 불러오기
fs.writeFileSync("notes.txt", "hii"); notes.txt파일 생성 및 내용 입력
fs.appendFileSync("notes.txt", " 한국산다"); notes.txt파일에 내용 추가
node는 'a', 'b'파일간에 기본적으로 그냥 변수 공유가 불가능하다
그럴때는 module.exports를 이용하여 변수를 사용할수 있다.
a에서
const name = require("./utils");
console.log(name);
b에서
const name = "lee";
module.exports = name;
하면 변수를 사용이 가능하다
node.js 에서 깃사용시 node_modules를 올리지 않는 방법
.gitignore을 생성하여
node_modules/ 을 추가하면 된다
validator 이메일,URL등 유효성을 검사해주는 모듈
chalk 로그를 색,bg색,굵기등등 나타내주는 모듈
nodemon 저장하면 바로 서버가 다시 자동으로 실행해주는 모듈
yargs 커맨드라인 인수를 분석하고 사용자 인터페이스를 생성하여 대화형 커맨드 라인을 구축할 수 있는 모듈
Author And Source
이 문제에 관하여(node.js 공부 정리), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@uon10/node.js-공부-정리-lifz6jn9저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)