Full Stack Software Developer
nodejs
mongodb
java
phantomjs
nodejs
linux
2016년 2월 17일 수요일
[nodejs] module 정의해서 사용하기 - 함수 만들기
1. 파일 이름 잘 정의하기
mymodule.js
2. exports 객체에 내가 정의하고 싶은 함수들 정의하기
exports.func_name = function(text) {
return text;
}
3. 사용하는 곳에서는
var mymod = require('./mymodule.js');
mymod.func_name('hi');
댓글 없음:
댓글 쓰기
최근 게시물
이전 게시물
홈
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기