mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-04 09:06:01 +00:00
added fully working astro example
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
---
|
||||
import { Api } from "bknd";
|
||||
const api = new Api({
|
||||
host: new URL(Astro.request.url).origin,
|
||||
headers: Astro.request.headers
|
||||
});
|
||||
const { data } = await api.data.readMany("todos");
|
||||
const user = api.getUser();
|
||||
console.log("user", user);
|
||||
|
||||
export const prerender = false;
|
||||
---
|
||||
|
||||
<h1>SSR</h1>
|
||||
<h2>Data</h1>
|
||||
<pre>{JSON.stringify(data, null, 2)}</pre>
|
||||
|
||||
<h2>User</h1>
|
||||
<pre>{JSON.stringify(user, null, 2)}</pre>
|
||||
|
||||
<a href="/admin">Admin</a> -
|
||||
<a href="/ssr">SSR (with auth)</a> -
|
||||
<a href="/">Home (static)</a>
|
||||
Reference in New Issue
Block a user