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

0.0.1 • Public • Published

PocketBase SSR

A small helper package for using PocketBase in server-side rendering (SSR) environments

[!WARNING] This package is still in development and can be unstable.

Installation

npm install pocketbase pocketbase-ssr
yarn add pocketbase pocketbase-ssr
pnpm add pocketbase pocketbase-ssr
bun add pocketbase pocketbase-ssr

Example Usage

With Request and Response

import { createServerClient } from "pocketbase-ssr";

async function handler({ req, res }: { req: Request; res?: Response }) {

    const pb = await createServerClient(process.env.POCKETBASE_URL!, { req, res });

    // Do something with the client

}

With Cookies

import { createServerClient } from "pocketbase-ssr";

async function handler() {

    const pb = await createServerClient(process.env.POCKETBASE_URL!, {

        cookies: {

            get(name: string) {

                // Return the cookie value

            },

            set(name: string, value: string) {

                // Set the cookie value

            }

        }

    });

    // Do something with the client

}

License

MIT

/pocketbase-ssr/

    Package Sidebar

    Install

    npm i pocketbase-ssr

    Weekly Downloads

    0

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    15.6 kB

    Total Files

    9

    Last publish

    Collaborators

    • kop7er