@aurelle/nest-appwrite
v0.1.1
Published
A NestJS module for Appwrite
Downloads
1
Readme
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();
}
}