mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-03 08:36:01 +00:00
23 lines
544 B
TypeScript
23 lines
544 B
TypeScript
import { createFrameworkApp } from "bknd/adapter";
|
|
import config from "../bknd.config";
|
|
|
|
export async function getApp() {
|
|
return await createFrameworkApp(config, process.env, {
|
|
force: import.meta.env && !import.meta.env.PROD,
|
|
});
|
|
}
|
|
|
|
export async function getApi(opts?: {
|
|
headers?: Headers | any;
|
|
verify?: boolean;
|
|
}) {
|
|
const app = await getApp();
|
|
if (opts?.verify && opts.headers) {
|
|
const api = app.getApi({ headers: opts.headers });
|
|
await api.verifyAuth();
|
|
return api;
|
|
}
|
|
|
|
return app.getApi();
|
|
}
|