I'm using Meteor and have created some classes on the server. How can I make them accessible when I want to declare them inside other files on the server?
For instance, I will be separating each class function into its own file as each one will be large. How can I initialise and use the class when I need it? E.g.
Importing a file could be done like this
var User = require('./userclass.js');
var user = new User();
server/lib/classfile.js
class User {
constructor(params) {
this._firstName = params.firstName;
this._lastName = params.lastName;
this._email = params.email;
}
}
server/file.js
var myVar = new User(someParams)
// this is undefined