반응형
module.export 로 함수/클래스 등을 export
-- sample.js
function edit(){}
function write(){}
module.exports = {
edit, //or edit:edit
write //or write:write
}
--------------
-- sampleClass.js
class update{}
module.exports = update
-------
-- sampleDirectExport.js
module.exports = {
id:'',
token:'',
fn:() => {
console.log('this is a function')
}
}
반응형
'NodeJs' 카테고리의 다른 글
map and filter (0) | 2020.01.10 |
---|---|
foreach (0) | 2020.01.10 |
Find and includes (0) | 2020.01.10 |
every (0) | 2020.01.10 |
Nodejs dev env setup (0) | 2020.01.10 |