All files / modules/server server.module.ts

63.64% Statements 7/11
100% Branches 0/0
0% Functions 0/3
55.56% Lines 5/9

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 338x       8x 8x                 8x   8x                                
import { Service, Container } from '../../utils/container/index';
import { Observable } from 'rxjs/Observable';
import { AppConfigInterface } from '../../utils/services/config/config.interface';
import { GraphQLSchema } from 'graphql';
import { ConfigService } from '../../utils/services/config/config.service';
import { ServerUtilService } from '../../utils/services/server/server.service';
import { Server, PluginBase, PluginNameVersion, PluginPackage } from 'hapi';
 
export interface Config {
    port: string;
    cert: any;
    schema: GraphQLSchema;
}
 
const utilService: ServerUtilService = Container.get(ServerUtilService);
@Service()
export class GapiServerModule {
 
    start(): Promise<Server> {
        return utilService.startServer();
    }
 
    public static forRoot(config: AppConfigInterface) {
        Container.get(ConfigService).setAppConfig(config);
        return GapiServerModule;
    }
 
    stop() {
        return utilService.stopServer();
    }
 
}