Hono
Set up Comark Content in a Hono server.
Hono hands you the raw web-standard Request as c.req.raw, so content.handler() mounts as a one-line wildcard route — on Node, Bun, Deno, Cloudflare Workers, or anywhere else Hono runs.
Install the packages
pnpm add comark-contentnpm install comark-contentyarn add comark-contentbun add comark-contentCreate the Content instance
content.ts
import { comarkContent } from 'comark-content'
import fs from 'comark-content/sources/fs'
export const content = comarkContent({
source: fs('./content'),
})Mount the handler
server.ts
import { Hono } from 'hono'
import { content } from './content'
const app = new Hono()
app.all('/api/content/*', (c) => content.handler(c.req.raw))
export default appThat's the whole data surface: GET /api/content/get/<path>, /api/content/list/..., /api/content/navigation, plus any custom serve handlers you register.
Read content from other routes
Routes on the same server skip HTTP and call the instance directly:
server.ts
app.get('/pages/:slug', async (c) => {
const page = await content.get(`/${c.req.param('slug')}`)
if (!page) return c.notFound()
return c.json(page)
})Consume it from a front-end
Any browser app talks to the mounted handler through the client, pass baseURL if the Hono server runs on another origin:
content-client.ts
import { createContentClient } from 'comark-content/client'
export const contentClient = createContentClient({
baseURL: 'https://api.example.com',
})