© 2026 Hedgehog Software, LLC
export default defineNuxtModule({ setup() { addServerHandler({ route: `docs/*`, handler: './docs/index.ts' }); } });
./docs/index.ts
import { defineEventHandler, serveStatic } from 'h3'; import { stat, readFile } from 'node:fs/promises'; import { join } from 'pathe'; export default defineEventHandler((event) => { const publicDir = '../public/docs/'; return serveStatic(event, { getContents: (id) => readFile(join(publicDir, id || 'index.html')), getMeta: async (id) => { const stats = await stat(join(publicDir, id)).catch(() => {}); if (!stats || !stats.isFile()) { return; } return { size: stats.size, mtime: stats.mtimeMs }; } }); });
Join the Discord to ask follow-up questions and connect with the community
Nuxt Community Chat Server
31,632 Members