logger.js
file exports object which contains only the
log()
function. Content of the
logger.js
file:
function log(message) {
  console.log(message)
}

module.exports.log = log
The
log()
function is called in the
index.js
file:
const logger = require('./logger')

logger.log('some text')
by Valeri Tandilashvili
2 years ago
Node
Node.js Tutorial for Beginners - 1 Hour
0
Pro tip: use ```triple backticks around text``` to write in code fences