Frog.image Context
The c
object is the parameter of the route handlers.
import { Frog } from 'frog'
export const app = new Frog()
app.image('/', (c) => {
return c.res({/* ... */})
})
req
- Type:
Request
import { Button, Frog } from 'frog'
export const app = new Frog()
app.image('/', (c) => {
const { req } = c
return c.res({/* ... */})
})
res
- Type:
(response: ImageResponse) => ImageResponse
The image response.
import { Button, Frog } from 'frog'
export const app = new Frog()
app.image('/', (c) => {
return c.res({/* ... */})
})
var
- Type:
HonoContext['var']
Extract a context value that was previously set via set
in Middleware.
import { Button, Frog } from 'frog'
export const app = new Frog()
app.use(async (c, next) => {
c.set('message', 'Frog is cool!!')
await next()
})
app.image('/', (c) => {
const message = c.var.message
return c.res({/* ... */})
})