// JavaScript SDKimport PocketBasefrom'pocketbase';const pb=newPocketBase('http://127.0.0.1:8090');...// list and search for 'example' collection recordsconst list=await pb.collection('example').getList(1,100,{filter:'title != "" && created > "2022-08-01"',sort:'-created,title',});// or fetch a single 'example' collection recordconst record=await pb.collection('example').getOne('RECORD_ID');// delete a single 'example' collection recordawait pb.collection('example').delete('RECORD_ID');// create a new 'example' collection recordconst newRecord=await pb.collection('example').create({title:'Lorem ipsum dolor sit amet',});// subscribe to changes in any record from the 'example' collectionpb.collection('example').subscribe('*',function(e){ console.log(e.record);});// stop listening for changes in the 'example' collectionpb.collection('example').unsubscribe();
Integrate nicely with your favorite frontend stack