github honojs/hono v1.2.0

latest releases: v4.3.2, v4.3.1, v4.3.0...
24 months ago

Summary

Handler and Middleware are treated as the same things

You can write middleware with app.HTTP_METHODS.

app.post('/posts', cors(), (c) => {
  return c.text('This is Handler')
})

Write multiple handlers at one

app.get('*', logger(), powerdBy(), handler)

app.route(path, Route)

Route enables grouping routes.

const book = new Route()

book.get('/', (c) => c.text('List Books')) // GET /book
book.get('/:id', (c) => {
  // GET /book/:id
  const id = c.req.param('id')
  return c.text('Get Book: ' + id)
})
book.post('/', (c) => c.text('Create Book')) // POST /book

app.route('/book', book)

Update and install

yarn add hono

What's Changed

New Contributors

Full Changelog: v1.1.1...v1.2.0

Don't miss a new hono release

NewReleases is sending notifications on new releases.