Response Methods in Hono

From the Hono cheat sheet · Context & Request · verified Jul 2026

Response Methods

Different ways to send responses

typescript
// Text response
app.get('/text', (c) => c.text('Hello!'))

// JSON response
app.get('/json', (c) => c.json({ msg: 'Hello!' }))

// HTML response
app.get('/html', (c) => c.html('<h1>Hello!</h1>'))

// With status code
app.post('/create', (c) => c.json({ id: 1 }, 201))

// Redirect
app.get('/old', (c) => c.redirect('/new'))
app.get('/external', (c) => c.redirect('https://hono.dev', 301))

// Set headers
app.get('/custom', (c) => {
  c.header('X-Custom', 'value')
  c.status(201)
  return c.json({ ok: true })
})
💡 c.json(), c.text(), c.html() are convenience methods
⚡ Pass status code as second argument: c.json(data, 201)
📌 Use c.header() to set response headers
🎯 Import cookie helpers from "hono/cookie"

More Hono tasks

Back to the full Hono cheat sheet