Skip to main content
Module

x/diosaur/docs/README.md

A dependency injection library for Deno
Latest
File

Diosaur

Diosaur (which stands for DI-osaur, such a good one tho), is a simple and straightforward dependency injection library for Node and Deno.

@Service()
class Doggo {
    constructor(@Parameter('doggoName') private name: string) {}

    bark() {
        return this.name.toUpperCase();
    }
}

@Service()
class JonSnow {

    @Inject()
    private doggo: Doggo;

    yell() {
        return `I'm Jon with my doggo ${this.doggo.bark()} !`;
    }
}

setParameter('doggoName', 'Ghost');
getContainer().then((container) => {
    const jon = container.get(JonSnow);
    console.log(jon.yell());
});