* @param {number} port * @param {StaticSite | null} staticSite
(port, staticSite)
| 32 | * @param {StaticSite | null} staticSite |
| 33 | */ |
| 34 | constructor(port, staticSite) { |
| 35 | super(); |
| 36 | this.port = port; |
| 37 | this.staticSite = staticSite; |
| 38 | this.server = createServer(this.requestListener); |
| 39 | this.serving = new Promise(resolve => this.server.on('listening', resolve)); |
| 40 | } |
| 41 | |
| 42 | serve() { |
| 43 | this.server.listen(this.port); |