(outputPath: string, baseUrl = '/')
| 103 | * Call .close() on the server return value to close the server. |
| 104 | */ |
| 105 | export async function externalServer(outputPath: string, baseUrl = '/'): Promise<ExternalServer> { |
| 106 | const app = express(); |
| 107 | app.use(baseUrl, express.static(resolve(outputPath))); |
| 108 | |
| 109 | return new Promise((resolve) => { |
| 110 | const server = app.listen(0, 'localhost', () => { |
| 111 | const { port } = server.address() as AddressInfo; |
| 112 | |
| 113 | resolve({ |
| 114 | server, |
| 115 | port, |
| 116 | url: `http://localhost:${port}${baseUrl}`, |
| 117 | }); |
| 118 | }); |
| 119 | }); |
| 120 | } |
| 121 | |
| 122 | export const baseHrefs: { [l: string]: string } = { |
| 123 | 'en-US': '/en/', |
no test coverage detected