Does Dgraph support Dgraph Module for Nestjs?

Hello im new in Dgraph.
When i tried to inject Dgraph as a module in Nestjs, I can see Dgraph does not support for module.
So i want to recommended Dgraph should support it.
It’s seem like

export declare class DgraphModule { 
    static register(options: DgraphModuleOptions): DynamicModule; 
    static registerAsync(options: DgraphModuleAsyncOptions): DynamicModule; 
    private static createAsyncProviders; 
    private static createAsyncOptionsProvider; 
}

So it can be use in Nestjs be like:

DgraphModule.registerAsync({ 
useFactory: async (configService: ConfigService) => ({ 
    stub: [ 
       { address: configService.get('DGRAPH_URL') }
    ], 
    debug: true  
  } ), 
  inject: [ConfigService] }
)

Its seem like some one write a library for it :
ref:https://github.com/val-samonte/nestjs-dgraph-example
But it does not support resignterAsync so can’t move url of Dgraph to env config. And it’s using Dgraph v1.2.1.
Nestjs and Dgraph are so powerful, i hope they can support each others more.

3 Likes

Thank you so much for mentioning nestjs. I also use NestJS and wanted to use the grpc client also.

I have forked the library and updated the dependencies and have it working with the latest release.

NestJS-Dgraph

To use this, for now I’m just adding in my yarn:

"@paulm17/nestjs-dgraph": "https://github.com/paulm17/nestjs-dgraph",

Feel free to clone and change to suit your circumstances.

2 Likes