mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
init: nuxt adapter
This commit is contained in:
15
examples/nuxt/server/middleware/bknd.ts
Normal file
15
examples/nuxt/server/middleware/bknd.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { serve } from "bknd/adapter/nuxt";
|
||||
import config from "../../bknd.config";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const pathname = event.path
|
||||
const request = toWebRequest(event);
|
||||
|
||||
if (pathname.startsWith("/api") || pathname !== "/") {
|
||||
const res = await serve(config, process.env)(request);
|
||||
|
||||
if (res && res.status !== 404) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user