exporting classes nodejs code example
Example 1: node js module export class
module.exports = class Person {
constructor(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
display() {
console.log(this.firstName + " " + this.lastName);
}
}
Example 2: how to export a class in node js
class TestClass {
}
module.exports.TestClass = TestClass;