How do I export a server-side class?


#1

Okay so say I have a package.

var net = Npm.require('net');
class Cylon {
  constructor(host, port) {
    this._messages = new net.Socket();
    this._messages.connect(port, host, () => {
      console.log('Connected message queue');
    });
  }
}

Then in my package.js, something like this.

Package.onUse(function (api) {
  api.versionsFrom('1.1.0.2');
  api.use('grigio:babel');

  api.addFiles('cylon.es6', 'server');
  api.export('Cylon', 'server');
});

However, it is never exported. I tried a different approach in the original file by adding this to the bottom of the file:

this.Cylon = Cylon;

It still never quite works. What do?