(path: string, htmlContent: string)
| 49 | } |
| 50 | |
| 51 | addHtmlRoute(path: string, htmlContent: string) { |
| 52 | if (this.#routes[path]) { |
| 53 | throw new Error(`Route ${path} was already setup.`); |
| 54 | } |
| 55 | this.#routes[path] = (_req: IncomingMessage, res: ServerResponse) => { |
| 56 | res.setHeader('Content-Type', 'text/html; charset=utf-8'); |
| 57 | res.statusCode = 200; |
| 58 | res.end(htmlContent); |
| 59 | }; |
| 60 | } |
| 61 | |
| 62 | addRoute( |
| 63 | path: string, |
no outgoing calls
no test coverage detected