# registerResolverService Function

Module
import { registerResolverService } from "@tsed/graphql"
Source/packages/graphql/src/registries/ResolverServiceRegistry.ts

# Overview

const registerResolverService: (provider: any, instance?: any) => void;

# Description

Add a new service in the ProviderRegistry. This service will be built when InjectorService will be loaded.

# Example

import {registerResolverService, InjectorService} from "@tsed/graphql";

export default class MyFooService {
    constructor(){}
    getFoo() {
        return "test";
    }
}

registerResolverService({provide: MyFooService});
// or
registerResolverService(MyFooService);

const injector = new InjectorService();
injector.load();

const myFooService = injector.get<MyFooService>(MyFooService);
myFooService.getFoo(); // test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18