ng-feathersjs
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.1 • Public • Published

    NgFeathers Library

    Introduction

    An angular library to communicate with a feathersjs backend. It supports authentication (strategy=local) and realtime database

    Installing

    npm install ng-feathersjs --save
    

    Init connection options

    Modify the environments/environment.ts to include

    export const environment = {
      ...
      feathers: {
        host: "http://localhost:3030",
        options: {
          transports: ['websocket'],
          forceNew: true
        }
      }
      ...
    };
    

    Init the client

    Add the NgFeathersModule to app.module.ts for example

    @NgModule({
      declarations: [...],
      imports: [
        ...
        NgFeathersModule.forRoot(environment.feathers),
        ...
      ],
      providers: [...],
      bootstrap: [...]
    })
    export class AppModule { }
    

    Authentication Module

    Import the NgFeathersAuthModule and use NgFeathersAuthService to manage authentication

    Check if the use if authenticated

    authService.authState.subscribe((authenticated: boolean) => { ... })
    

    Retrieve the connected user

    authService.user.subscribe((user: User) => { ... })
    

    Sign in

    authService.signIn(email, password, strategy?).subscribe((user: User) => { ... })
    

    Sign out

    authService.signOut().subscribe(_ => { ... })
    

    Database module

    Import the NgFeathersDbModule feathersjs query rules and filter apply to NgFeathers

    Retrieve a feathersjs service

    dbService.service(location)
    

    Retrieve a document

    dbService.service(location).doc(docId)
    

    Use valueChanges() to listen to changes Use set to replace the content of the document Use update to update the document Use remove to delete the document

    Retrieve a collection

    dbService.service(location).collection(query)
    

    Use valueChanges() to listen to changes Use set to replace the content of the document Use update to update the document Use remove to delete the document

    Install

    npm i ng-feathersjs

    DownloadsWeekly Downloads

    11

    Version

    0.1.1

    License

    none

    Unpacked Size

    372 kB

    Total Files

    50

    Last publish

    Collaborators

    • anas.sahel