0.1.1 • Published 9 months ago

@aurelle/nest-appwrite v0.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

Overview

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AppwriteDatabaseModule, AppwriteModule } from '@aurelle/nest-appwrite';

@Module({
  imports: [
    AppwriteModule.forRoot({
      apiKey:
        'XXX',
      projectId: 'XXX',
      endpoint: 'https://appwrite.example.com/v1',
    }),
    AppwriteDatabaseModule.forRoot({
      databaseId: 'library',
    }),
    AppwriteDatabaseModule.forCollections(['books'])
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
import { Collection } from '@aurelle/nest-appwrite'

export interface Book {
    title: string;
    author: string;
}

@Injectable()
export class AppService {
    constructor(
        @InjectCollection('books') 
        private readonly books: Collection<Book>
    ) {}

    getBooks(): Promise<Book[]> {
        return this.books.list();
    }
}
0.1.1

9 months ago

0.1.0

9 months ago

0.0.1

9 months ago

0.0.0

9 months ago