mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
minor fixes for nextjs
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
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 app = await getApp();
|
||||
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 { 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();
|
||||
|
||||
export const config = {
|
||||
connection: {
|
||||
// make sure to use a remote URL for production!
|
||||
url: "file:data.db",
|
||||
url: process.env.DB_URL as string,
|
||||
authToken: process.env.DB_TOKEN as string,
|
||||
},
|
||||
} as const satisfies NextjsBkndConfig;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user