v1.2.0
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
- test: add tests for builtin middleware by @yusukebe in #192
- feat(compose): compose both the ordinary middlewares and response middlewares by @metrue in #195
- ci: ci any PR by @yusukebe in #197
- feat: multiple matching routes for
TrieRouter
by @yusukebe in #196 - test(compose): a move comprehensive test cases by @metrue in #198
- feat: make everything(including Middleware) as
Handler
by @yusukebe in #193 - fix: handle not found response by @yusukebe in #202
- fix: handling not found in
compose.ts
by @yusukebe in #204 - feat:
app.route(path, Route)
by @yusukebe in #203 - fix(router): fix
trie-router
bugs by @yusukebe in #208 - docs: update readme wrangler2 no longer in beta by @patotoma in #209
- feat(trie-router): error handling for duplicate param name by @yusukebe in #215
- perf: make it faster by @yusukebe in #219
- feat: multiple matching routes for RegExpRouter by @usualoma in #220
- for v1.2.0 by @yusukebe in #221
- fix: Some RegExpRouter bugs by @usualoma in #222
- feat(reg-exp-router): error handling for duplicate param name by @usualoma in #224
- docs: remove Japanese README by @yusukebe in #225
New Contributors
Full Changelog: v1.1.1...v1.2.0