Skip to content

Instantly share code, notes, and snippets.

@yusukebe
Created June 30, 2026 14:58
Show Gist options
  • Select an option

  • Save yusukebe/afd27a571b50df7a3e119854e0d02fa3 to your computer and use it in GitHub Desktop.

Select an option

Save yusukebe/afd27a571b50df7a3e119854e0d02fa3 to your computer and use it in GitHub Desktop.
import { Hono } from 'hono'
import { feedRenderer } from './renderer'
const app = new Hono()
app.get('/feed', feedRenderer({ baseUrl: 'https://example.com' }), (c) => c.render(items, { format: 'atom' }))
export default app
import type { MiddlewareHandler } from 'hono'
import type { Feed } from './feed'
import { serveFeed } from './serve'
import type { FeedInput, ServeFeedOptions } from './types'
declare module 'hono' {
interface ContextRenderer {
(input: FeedInput | Feed, options?: ServeFeedOptions): Response
}
}
export function feedRenderer(defaults: ServeFeedOptions = {}): MiddlewareHandler {
return async (c, next) => {
c.setRenderer((input, options) => serveFeed(c, input, { ...defaults, ...options }))
await next()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment