NestJS · Junior · Question 28 of 75

How do you register a plain value as a provider, e.g. a config object?

providers: [{ provide: "APP_CONFIG", useValue: { retries: 3 } }]

Explanation

Custom providers also support useClass, useFactory and useExisting. Tokens can be strings, symbols or classes.

Further reading

Problem with a question

NestJS · Junior · question 28

Test yourself

Take the NestJS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz