mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
minor fixes for nextjs
This commit is contained in:
@@ -68,7 +68,7 @@ export async function replacePackageJsonVersions(
|
|||||||
|
|
||||||
export async function updateBkndPackages(dir?: string, map?: Record<string, string>) {
|
export async function updateBkndPackages(dir?: string, map?: Record<string, string>) {
|
||||||
const versions = {
|
const versions = {
|
||||||
bknd: "^" + (await sysGetVersion()),
|
bknd: await sysGetVersion(),
|
||||||
...(map ?? {}),
|
...(map ?? {}),
|
||||||
};
|
};
|
||||||
await replacePackageJsonVersions(
|
await replacePackageJsonVersions(
|
||||||
|
|||||||
@@ -264,7 +264,6 @@ export class FetchPromise<T = ApiResponse<any>> implements Promise<T> {
|
|||||||
} else {
|
} else {
|
||||||
resBody = res.body;
|
resBody = res.body;
|
||||||
}
|
}
|
||||||
console.groupEnd();
|
|
||||||
|
|
||||||
return createResponseProxy<T>(res, resBody, resData);
|
return createResponseProxy<T>(res, resBody, resData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ export class ModuleManager {
|
|||||||
|
|
||||||
return result as unknown as ConfigTable;
|
return result as unknown as ConfigTable;
|
||||||
},
|
},
|
||||||
this.verbosity > Verbosity.silent ? [] : ["log", "error", "warn"],
|
this.verbosity > Verbosity.silent ? [] : ["error"],
|
||||||
);
|
);
|
||||||
|
|
||||||
this.logger
|
this.logger
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { getApp } from "@/bknd";
|
import { getApp } from "@/bknd";
|
||||||
|
|
||||||
|
// if you're not using a local media adapter, or file database,
|
||||||
|
// you can uncomment this line to enable running bknd on edge
|
||||||
|
// export const runtime = "edge";
|
||||||
|
|
||||||
const handler = async (request: Request) => {
|
const handler = async (request: Request) => {
|
||||||
const app = await getApp();
|
const app = await getApp();
|
||||||
return app.fetch(request);
|
return app.fetch(request);
|
||||||
|
|||||||
3
examples/nextjs/src/app/env/route.ts
vendored
Normal file
3
examples/nextjs/src/app/env/route.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export const GET = async (req: Request) => {
|
||||||
|
return Response.json(process.env);
|
||||||
|
};
|
||||||
@@ -2,12 +2,20 @@ import { type NextjsBkndConfig, getApp as getBkndApp } from "bknd/adapter/nextjs
|
|||||||
import { registerLocalMediaAdapter } from "bknd/adapter/node";
|
import { registerLocalMediaAdapter } from "bknd/adapter/node";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
|
// The local media adapter works well in development, and server based
|
||||||
|
// deployments. However, on vercel or any other serverless deployments,
|
||||||
|
// you shouldn't use a filesystem based media adapter.
|
||||||
|
//
|
||||||
|
// Additionally, if you run the bknd api on the "edge" runtime,
|
||||||
|
// this would not work as well.
|
||||||
|
//
|
||||||
|
// For production, it is recommended to uncomment the line below.
|
||||||
registerLocalMediaAdapter();
|
registerLocalMediaAdapter();
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
connection: {
|
connection: {
|
||||||
// make sure to use a remote URL for production!
|
url: process.env.DB_URL as string,
|
||||||
url: "file:data.db",
|
authToken: process.env.DB_TOKEN as string,
|
||||||
},
|
},
|
||||||
} as const satisfies NextjsBkndConfig;
|
} as const satisfies NextjsBkndConfig;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user