node.js define main code example
Example: node main
// main.js / main.ts (the filename doesn't matter)
function main() {
console.log("Hello world");
}
if (require.main === module) {
main();
}
// main.js / main.ts (the filename doesn't matter)
function main() {
console.log("Hello world");
}
if (require.main === module) {
main();
}