Skip to content

BerniHC/ngx-pocketbase

Repository files navigation

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'}),], ... })exportclassAppModule{}

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

import{PocketBaseService}from'ngx-pocketbase'; ... constructor(privatepb: PocketBaseService){// list and filter "example" collection recordsconstresult=awaitpb.collection('example').getList(1,20,{filter: 'status = true && created > "2022-08-01 10:00:00"'});// authenticate as auth collection recordconstuserData=awaitpb.collection('users').authWithPassword('[email protected]','123456');// or as super-adminconstadminData=awaitpb.admins.authWithPassword('[email protected]','123456');// and much more...}

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

About

PocketBase Angular SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published