ngx-pocketbase
TypeScript icon, indicating that this package has built-in type declarations

0.14.3-rc.4 • Public • Published

PocketBase Angular SDK

PocketBase Angular SDK for interacting with the PocketBase API. Based on the PocketBase JavaScript SDK

Installation

Node.js (via npm)

npm install ngx-pocketbase --save

Usage

Add the PocketBase module to your app.module.ts:

import {PocketBaseModule} from 'ngx-pocketbase';

@NgModule({
    ...
    imports: [
        PocketBaseModule.init({ baseUrl: 'http://127.0.0.1:8090' }),
    ],
    ...
})
export class AppModule {
}

Then, import the PocketBase service and inject it into a constructor:

import { PocketBaseService } from 'ngx-pocketbase';

...

constructor(
    private pb: PocketBaseService
) {
    // list and filter "example" collection records
    const result = await pb.collection('example').getList(1, 20, {
        filter: 'status = true && created > "2022-08-01 10:00:00"'
    });

    // authenticate as auth collection record
    const userData = await pb.collection('users').authWithPassword('test@example.com', '123456');

    // or as super-admin
    const adminData = await pb.admins.authWithPassword('test@example.com', '123456');

    // and much more...
}

More detailed API docs and copy-paste examples could be found in the API documentation for each service.

Readme

Keywords

none

Package Sidebar

Install

npm i ngx-pocketbase

Weekly Downloads

1

Version

0.14.3-rc.4

License

none

Unpacked Size

632 kB

Total Files

62

Last publish

Collaborators

  • bernihc