Closed rangav closed 6 years ago
Hi
This is a suggestion, Too many conditions check in constructor, my suggestion below
let server = new StaticServer({port: 8080, localOnly : true, keepAlive : true });
class StaticServer { constructor(opts) { if(opts) { this.port = `${opts.port}` || PORT; this.root = opts.root || ROOT; this.localOnly = opts.localOnly || false; this.keepAlive = opts.keepAlive || false; } else{ this.port = PORT; this.root = ROOT; this.localOnly = false; this.keepAlive = false; } } .... }
let me know your feedback
Agreed this could be simpler, but don't think it is worth breaking changes.
Hi
This is a suggestion, Too many conditions check in constructor, my suggestion below
let server = new StaticServer({port: 8080, localOnly : true, keepAlive : true });
let me know your feedback