honojs / website

Repository for hono.dev
https://hono.dev
78 stars 261 forks source link

Add new grouping example #290

Closed exoego closed 5 months ago

exoego commented 6 months ago

When I migrated my app from Express to Hono, I needed this example.

Express

const book = express()
book.get('/book', ...)
book.post('/book', ...)

const user = express()
user.get('/user', ...)
user.post('/user', ...)

const app = user.use(book) // no base path needed

Hono

const book = new Hono()
book.get('/book', ...)
book.post('/book', ...)

const user = new Hono()
user.get('/user', ...)
user.post('/user', ...)

const app = user.route('/', book)
yusukebe commented 5 months ago

Nice! Thanks @exoego