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

serveStatic isn't working #118

Open
ibnumusyaffa opened this issue Dec 31, 2023 · 2 comments
Open

serveStatic isn't working #118

ibnumusyaffa opened this issue Dec 31, 2023 · 2 comments

Comments

@ibnumusyaffa
Copy link

serve static is not working, iam not using absolute path, minimal repro https://github.com/ibnumusyaffa/hono-serve-static-not-working

@ibnumusyaffa
Copy link
Author

image

@yusukebe
Copy link
Member

yusukebe commented Jan 1, 2024

Hi @ibnumusyaffa

Thank you for creating the issue.

You can do what you want to do with the following code:

app.get(
  "/static/*",
  serveStatic({
    root: "./storage",
    rewriteRequestPath: (path: string) => path.replace(/^\/static/, ""),
  })
)

I would like to introduce onNotFound() because the current implementation of @hono/node-server is difficult to debug when a file is not found.

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