fastify/fastify-awilix

Configure injection mode

jm42 opened this issue ยท 1 comments

jm42 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