pocketbase-vite-serverside
v0.1.1
Published
Hey there, I made this light version to have a way to call authorization once to pocketbase while building my static site [NPM package](https://www.npmjs.com/package/pocketbase-vite-serverside)
Downloads
5
Readme
PocketBase Vite Serverside
Hey there, I made this light version to have a way to call authorization once to pocketbase while building my static site NPM package
Install by one of the following
yarn add pocketbast-vite-serverside
npm i pocketbase-vite-serverside
Add the env variables (see examples below)
call
import { authPb } from "pocketbase-vite-serverside";
in the files you want to make a requst fromCall
authPb
like the normalpb
clientimport { authPb } from "pocketbase-vite-serverside"; const records = await authPb .collection("events") .getFullList(200, { sort: "-created" });
All you need to do is in your .env
file is to fill out the following env vars. Here's a template below
For using admin login add the following
PB_USERNAME="[email protected]"
PB_PASSWORD="adminpassowrd"
PB_AUTH_METHOD="admin-email" #This is to declare which login method
PB_URL="https://your.pocketbase.url"
Next up
I will be implementing table based login such as 'users' and token based login. If anyone wants to contribute feel free to make a PR with these implementations!