0.5.1 • Published 4 months ago

nest-neogma v0.5.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

Nest Logo Neogma Logo

Nest Neogma

Neogma integration for Nest

Description

This repository provides a Neogma integration for Nest.

Installation

yarn add nest-neogma

Quick Start

Register the Neogma Module in your application using the forRoot method, passing the Neogma connection information as an object:

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { NeogmaModule } from 'nest-neogma'

@Module({
  imports: [
    NeogmaModule.forRoot({
      scheme: 'neo4j',
      host: 'localhost',
      port: 7687,
      username: 'neo4j',
      password: 'neo'
    })
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

Querying with Neogma

The Neogma instance is @Injectable, so can be passed into any constructor with the @InjectConnection decorator:

import { InjectConnection } from 'nest-neogma'
import { Neogma } from 'neogma'

@Controller()
export class AppController {
  constructor(
    @InjectConnection()
    private neogma: Neogma,
  ) {}

  @Get()
  async getHello(): Promise<string> {
    const res =  await this.neogma.queryRunner
      .run("MATCH (n) RETURN COUNT(n) as count LIMIT 5")

    return `There are ${res.records[0].get('count')} nodes in the database`
  }
}

More Information

For more information about running Neogma in your Node.js or TypeScript project, check out the official Neogma Documentation.

TODO

  • Add support for models with NeogmaModule.forFeature

0.5.0

4 months ago

0.5.1

4 months ago

0.4.3

8 months ago

0.3.0

8 months ago

0.4.1

8 months ago

0.3.2

8 months ago

0.4.0

8 months ago

0.3.1

8 months ago

0.4.2

8 months ago

0.3.3

8 months ago

0.2.0

10 months ago

0.1.0

10 months ago