mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-19 05:46:04 +00:00
19 lines
459 B
TypeScript
19 lines
459 B
TypeScript
import type { App, AppPlugin } from "bknd";
|
|
import { showRoutes as showRoutesHono } from "hono/dev";
|
|
|
|
export type ShowRoutesOptions = {
|
|
once?: boolean;
|
|
};
|
|
|
|
export function showRoutes({ once = false }: ShowRoutesOptions = {}): AppPlugin {
|
|
let shown = false;
|
|
return (app: App) => ({
|
|
name: "bknd-show-routes",
|
|
onBuilt: () => {
|
|
if (once && shown) return;
|
|
shown = true;
|
|
showRoutesHono(app.server);
|
|
},
|
|
});
|
|
}
|