Node JS Vérifiez si appelé à partir du module
if (require.main === module) {
console.log('called directly');
} else {
console.log('required as a module');
}
garzj
if (require.main === module) {
console.log('called directly');
} else {
console.log('required as a module');
}