()
| 111 | } |
| 112 | |
| 113 | async customFileServer() { |
| 114 | // TODO: support for micro(1)-like handlers! |
| 115 | if (this.startupLogging) { |
| 116 | logger.info('starting custom server'); |
| 117 | } |
| 118 | let server; |
| 119 | |
| 120 | try { |
| 121 | server = require(resolve(this.serverPath)); |
| 122 | } catch (error) { |
| 123 | logger.error(`couldn't load server ${this.serverPath}: ${error}`); |
| 124 | } |
| 125 | this.customServerTimeout = setTimeout(() => { |
| 126 | if (this.startupLogging) logger.warn('custom server taking a long time to start'); |
| 127 | if (this.startupLogging) logger.warn("**don't forget to invoke callback()**"); |
| 128 | }, longCallbackTime); |
| 129 | const serverConfig = Object.assign({ |
| 130 | port: this.port, hostname: this.hostname, path: this.publicPath |
| 131 | }, this.fileServerConfig || {}); |
| 132 | debug(`Invoking custom startServer with: ${JSON.stringify(serverConfig)}`); |
| 133 | this._connection = await launchServerFileModule(server, this.port, this.publicPath, serverConfig); |
| 134 | clearTimeout(this.customServerTimeout); |
| 135 | |
| 136 | logger.info('custom server started, initializing watcher'); |
| 137 | return this; |
| 138 | } |
| 139 | |
| 140 | customCommandServer() { |
| 141 | const {serverCommand} = this; |
no test coverage detected