Skip to content
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

Route issue in route example #28

Open
socketopp opened this issue Oct 6, 2022 · 1 comment
Open

Route issue in route example #28

socketopp opened this issue Oct 6, 2022 · 1 comment

Comments

@socketopp
Copy link

Hi,
Good job on Hono!

Followed this hono-example-blog example.

The route will become /post/post, not /post.

Index.ts should have this instead, think it would fix it.

app.route('/', middleware)
app.route('/', api)

Am I wrong? Please explain to me in that case how you're suppose to you app.route correct.

@yusukebe
Copy link
Member

Hi @socketopp !

In that example, the route will become /api/posts. The path /posts will be appended to the path /api specified in route, and they will be merged:

api.get('/posts', (c) => c.text('Hi'))

//...

app.route('/api', api) // GET /api/posts => Hi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants