mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
added fallback route to server, created extensive setup instructions in docs
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
// @ts-ignore somehow causes types:build issues on app
|
||||
import { type BunAdapterOptions, serve } from "bknd/adapter/bun";
|
||||
import { type BunBkndConfig, serve } from "bknd/adapter/bun";
|
||||
|
||||
// Actually, all it takes is the following line:
|
||||
// serve();
|
||||
|
||||
// this is optional, if omitted, it uses an in-memory database
|
||||
const config: BunAdapterOptions = {
|
||||
const config: BunBkndConfig = {
|
||||
connection: {
|
||||
type: "libsql",
|
||||
config: {
|
||||
|
||||
6
examples/bun/minimal.ts
Normal file
6
examples/bun/minimal.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createApp } from "bknd";
|
||||
|
||||
const app = createApp();
|
||||
await app.build();
|
||||
|
||||
export default app;
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InferGetServerSidePropsType } from "next";
|
||||
import type { InferGetServerSidePropsType as InferProps } from "next";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
import { withApi } from "bknd/adapter/nextjs";
|
||||
@@ -16,9 +16,7 @@ export const getServerSideProps = withApi(async (context) => {
|
||||
};
|
||||
});
|
||||
|
||||
export default function AdminPage({
|
||||
user
|
||||
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
||||
export default function AdminPage({ user }: InferProps<typeof getServerSideProps>) {
|
||||
if (typeof document === "undefined") return null;
|
||||
return (
|
||||
<Admin withProvider={{ user }} config={{ basepath: "/admin", logo_return_path: "/../" }} />
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
// pages/admin/[[...admin]].tsx
|
||||
import { withApi } from "bknd/adapter/nextjs";
|
||||
// pages/admin/[[...admin]].tsx
|
||||
import type { InferGetServerSidePropsType as InferProps } from "next";
|
||||
import dynamic from "next/dynamic";
|
||||
import "bknd/dist/styles.css";
|
||||
|
||||
/*export const config = {
|
||||
runtime: "experimental-edge"
|
||||
}*/
|
||||
|
||||
const Admin = dynamic(() => import("bknd/ui").then((mod) => mod.Admin), {
|
||||
ssr: false,
|
||||
ssr: false
|
||||
});
|
||||
|
||||
export const getServerSideProps = withApi(async (context) => {
|
||||
return {
|
||||
props: {
|
||||
user: context.api.getUser(),
|
||||
},
|
||||
user: context.api.getUser()
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
export default function AdminPage() {
|
||||
export default function AdminPage({ user }: InferProps<typeof getServerSideProps>) {
|
||||
if (typeof document === "undefined") return null;
|
||||
return <Admin withProvider config={{ basepath: "/admin" }} />;
|
||||
return <Admin withProvider={{ user }} config={{ basepath: "/admin" }} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user