# nest-nedb **Repository Path**: hungtcs/nest-nedb ## Basic Information - **Project Name**: nest-nedb - **Description**: NEDB module for Nest framework (node.js) - **Primary Language**: TypeScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2019-08-23 - **Last Updated**: 2022-02-21 ## Categories & Tags **Categories**: node-plugins **Tags**: None ## README
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master [travis-url]: https://travis-ci.org/nestjs/nest [linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux [linux-url]: https://travis-ci.org/nestjs/nestA progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
## Description The [NEDB](https://github.com/louischatriot/nedb) module for [Nest](https://github.com/nestjs/nest). ## Installation ```bash $ npm i --save @hungtcs-box/nest-nedb nedb $ npm i --save-dev @types/nedb ``` ## Quick Start 1. First in your model file, extends the base `Model` ```ts import { Model } from '@hungtcs-box/nest-nedb'; export class UserModel extends Model { username?: string; } ``` 2. Import `NedbModule.forFeature` in your `UsersModule` ```ts import { UserModel } from './models/user.model'; import { NedbModule } from '@hungtcs-box/nest-nedb'; @Module({ imports: [ PasswdModule, NedbModule.forFeature([ { model: UserModel, indexes: { username: { unique: true, }, }, }, ]), ], exports: [ UsersService, ], providers: [ UsersService, ], controllers: [ UsersController, ], }) export class UsersModule { } ``` 3. Import `NedbModule.forRoot` in your `AppModule` ```js import { NedbModule } from '@hungtcs-box/nest-nedb'; @Module({ imports: [ NedbModule.forRoot(`path/to/your/database/file`), ], controllers: [ AppController, ], }) export class AppModule { } ``` 4. Now you can inject the nedb DataStore in your `UserService` ```ts @Injectable() export class UsersService { constructor( @InjectDatastore(UserModel) private readonly dataStore: DataStore