mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
* refactored adapters to run test suites * fix bun version for tests * added missing adapter tests and refactored examples to use `bknd.config.ts` where applicable
18 lines
485 B
TypeScript
18 lines
485 B
TypeScript
import { getApp as getBkndApp } from "bknd/adapter/react-router";
|
|
import config from "../bknd.config";
|
|
|
|
export async function getApp() {
|
|
return await getBkndApp(config, process.env as any);
|
|
}
|
|
|
|
export async function getApi(args?: { request: Request }, opts?: { verify?: boolean }) {
|
|
const app = await getApp();
|
|
if (opts?.verify) {
|
|
const api = app.getApi({ headers: args?.request.headers });
|
|
await api.verifyAuth();
|
|
return api;
|
|
}
|
|
|
|
return app.getApi();
|
|
}
|