Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import FileEngine from '../../infrastructure/files/file.engine';
import Logger from '../../infrastructure/logging/logger';
import ServeService from '../../infrastructure/serving/serve';
import { InternalConfiguration } from '../entities/internal-configuration';
export class ServeFiles {
private static instance: ServeFiles;
private server;
constructor() {}
public static getInstance() {
Eif (!ServeFiles.instance) {
ServeFiles.instance = new ServeFiles();
}
return ServeFiles.instance;
}
public serve(configuration: InternalConfiguration) {
Iif (!FileEngine.existsSync(configuration.output)) {
Logger.error(`${configuration.output} folder doesn't exist`);
process.exit(1);
} else {
this.displayServingMessage(configuration);
this.server = ServeService.serve(configuration);
}
}
public stop() {
this.server.close();
}
private displayServingMessage(configuration: InternalConfiguration) {
Logger.info(
`Serving documentation from ${configuration.output} at http://${configuration.hostname}:${configuration.port}`
);
}
}
export default ServeFiles.getInstance();
|