apollo server build schema passing parameters to classes

Solutions on MaxInterview for apollo server build schema passing parameters to classes by the best coders in the world

showing results for - "apollo server build schema passing parameters to classes"
Matías
18 Jan 2020
1// https://github.com/MichalLytek/type-graphql/blob/master/docs/dependency-injection.md
2
3import { buildSchema } from "type-graphql";
4// import your IoC container
5import { Container } from "typedi";
6
7import { SampleResolver } from "./resolvers";
8
9// build the schema as always
10const schema = await buildSchema({
11  resolvers: [SampleResolver],
12  // register the 3rd party IOC container
13  container: Container,
14});