-
-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to structure large apis using hono? #200
Comments
Currently, we can write routing using export const app = new Hono()
const root = app.route('/v1')
root.get('/', (c) => c.text('getUsers'))
root.post('/', (c) => c.text('createUser')) And, This syntax may be available in the next release. root.post('/', basicAuth(), cors(), (c) => c.text('getUsers')) // <--- this syntax is coming soon! I think this is not such a smart design for large APIs, so I want to add another way for routing, such as below: import { Hono, Route } from 'hono'
const app = new Hono()
const route = new Route()
route.get('/entry', handler, handler).post(handler, handler)
app.use('/v1', route)
app.fire() This is still just the idea. Conclusion, please use |
What is the eta for the next release? Thanks! |
This feature is already implemented #203 . |
We released v1.2.0. See: https://github.com/honojs/hono/releases/tag/v1.2.0. |
|
Traditionally using express I would have this file structure:
And then in
users.route.js
I would define all my routes relating to users e.g.In
routes/index.js
I would apply the base urls to all my defined routes and then in the top levelindex.js
I would import and enable them:What is the recommended way of doing this in Hono?
The text was updated successfully, but these errors were encountered: