mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
docs(solid-start): add JSDoc comments to adapter functions
This commit is contained in:
@@ -3,6 +3,11 @@ import { createRuntimeApp, type RuntimeBkndConfig } from "bknd/adapter";
|
|||||||
export type SolidStartEnv = NodeJS.ProcessEnv;
|
export type SolidStartEnv = NodeJS.ProcessEnv;
|
||||||
export type SolidStartBkndConfig<Env = SolidStartEnv> = RuntimeBkndConfig<Env>;
|
export type SolidStartBkndConfig<Env = SolidStartEnv> = RuntimeBkndConfig<Env>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bknd app instance
|
||||||
|
* @param config - bknd configuration
|
||||||
|
* @param args - environment variables
|
||||||
|
*/
|
||||||
export async function getApp<Env = SolidStartEnv>(
|
export async function getApp<Env = SolidStartEnv>(
|
||||||
config: SolidStartBkndConfig<Env>,
|
config: SolidStartBkndConfig<Env>,
|
||||||
args: Env = process.env as Env,
|
args: Env = process.env as Env,
|
||||||
@@ -10,7 +15,11 @@ export async function getApp<Env = SolidStartEnv>(
|
|||||||
return await createRuntimeApp(config, args);
|
return await createRuntimeApp(config, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create middleware handler for Solid Start
|
||||||
|
* @param config - bknd configuration
|
||||||
|
* @param args - environment variables
|
||||||
|
*/
|
||||||
export function serve<Env = SolidStartEnv>(
|
export function serve<Env = SolidStartEnv>(
|
||||||
config: SolidStartBkndConfig<Env> = {},
|
config: SolidStartBkndConfig<Env> = {},
|
||||||
args: Env = process.env as Env,
|
args: Env = process.env as Env,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { DB } from "bknd";
|
import type { DB } from "bknd";
|
||||||
import { Suspense } from "solid-js";
|
import { For, Suspense } from "solid-js";
|
||||||
import { Footer } from "~/components/Footer";
|
import { Footer } from "~/components/Footer";
|
||||||
import { List } from "~/components/List";
|
import { List } from "~/components/List";
|
||||||
import { getApi } from "~/lib/bknd";
|
import { getApi } from "~/lib/bknd";
|
||||||
@@ -58,9 +58,9 @@ export default function Home() {
|
|||||||
return (
|
return (
|
||||||
<div class="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 ">
|
<div class="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 ">
|
||||||
<main class="flex flex-col gap-8 row-start-2 items-center sm:items-start">
|
<main class="flex flex-col gap-8 row-start-2 items-center sm:items-start">
|
||||||
<div class="flex flex-row items-center ">
|
<div class="flex flex-row items-center justify-evenly min-w-full">
|
||||||
<img
|
<img
|
||||||
class="dark:invert size-18"
|
class="size-18"
|
||||||
src="/solid.svg"
|
src="/solid.svg"
|
||||||
alt="Solid Start logo"
|
alt="Solid Start logo"
|
||||||
/>
|
/>
|
||||||
@@ -86,15 +86,14 @@ export default function Home() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div class="flex flex-col gap-3">
|
<div class="flex flex-col gap-3">
|
||||||
{data()?.todos?.
|
<For each={data()?.todos?.splice(0, data()?.limit ?? 0)}>
|
||||||
splice(0, data()?.limit ?? 0)
|
{(todo) => (
|
||||||
.map((todo) => (
|
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
<div class="flex flex-row flex-grow items-center gap-3 ml-1">
|
<div class="flex flex-row flex-grow items-center gap-3 ml-1">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="flex-shrink-0 cursor-pointer"
|
class="flex-shrink-0 cursor-pointer"
|
||||||
checked={!!todo.done}
|
checked={Boolean(todo.done)}
|
||||||
onChange={async () => {
|
onChange={async () => {
|
||||||
await updateTodo(todo);
|
await updateTodo(todo);
|
||||||
}}
|
}}
|
||||||
@@ -113,7 +112,8 @@ export default function Home() {
|
|||||||
❌
|
❌
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
)}
|
||||||
|
</For>
|
||||||
</div>
|
</div>
|
||||||
<form
|
<form
|
||||||
class="flex flex-row w-full gap-3 mt-2"
|
class="flex flex-row w-full gap-3 mt-2"
|
||||||
@@ -124,7 +124,7 @@ export default function Home() {
|
|||||||
type="text"
|
type="text"
|
||||||
name="title"
|
name="title"
|
||||||
placeholder="New todo"
|
placeholder="New todo"
|
||||||
class="py-2 px-4 flex flex-grow rounded-sm bg-foreground/10 focus:bg-foreground/20 transition-colors outline-none"
|
class="py-2 px-4 flex flex-grow rounded-sm bg-black/5 focus:bg-black/10 dark:bg-white/5 dark:focus:bg-white/10 transition-colors outline-none"
|
||||||
/>
|
/>
|
||||||
<button type="submit" class="cursor-pointer" disabled={submission.pending}>
|
<button type="submit" class="cursor-pointer" disabled={submission.pending}>
|
||||||
{submission.pending ? "Adding..." : "Add"}
|
{submission.pending ? "Adding..." : "Add"}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export default function Home() {
|
|||||||
return (
|
return (
|
||||||
<div class="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20">
|
<div class="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20">
|
||||||
<main class="flex flex-col gap-8 row-start-2 items-center sm:items-start">
|
<main class="flex flex-col gap-8 row-start-2 items-center sm:items-start">
|
||||||
<div class="flex flex-row items-center ">
|
<div class="flex flex-row items-center justify-evenly min-w-full">
|
||||||
<img
|
<img
|
||||||
class="dark:invert size-18"
|
class="dark:invert size-18"
|
||||||
src="/solid.svg"
|
src="/solid.svg"
|
||||||
|
|||||||
Reference in New Issue
Block a user