fastify / fastify-awilix

Dependency injection support for fastify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Configure injection mode

jm42 opened this issue Β· comments

commented

πŸš€ Allow change Awilix injection mode

When using Awilix with Typescript, CLASSIC injection mode seems to be more desirable.

Motivation

Awilix creator @jeffijoe comment:

I used to prefer the options object (which was the reason I created Awilix using Proxies to begin with), however the problem with incorrect parameter passing goes away with TypeScript, and so I've started preferring the classic approach personally. Doesn't hurt that it's faster, too, hehe.

Example

fastify.register(fastifyAwilixPlugin, {
  injectionMode: 'CLASSIC' // InjectionMode.CLASSIC
})

Released in 1.2.0