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

add support for absolute path to serveStatic root #187

Open
charlyoleg2 opened this issue Aug 17, 2024 · 2 comments
Open

add support for absolute path to serveStatic root #187

charlyoleg2 opened this issue Aug 17, 2024 · 2 comments

Comments

@charlyoleg2
Copy link

charlyoleg2 commented Aug 17, 2024

Could you add support for absolute path for the root of the serveStatic?
In my use-case designix-uis, an absolute path to the folder containing the static files is required as tool can be called from any directory. Currently i"m using Express, but i"d like to replace it with Hono and this feature is missing.
The following patch in the file src/serve-static.ts might be sufficient for supporting the absolute path:

-      path = addCurrentDirPrefix(path)
+      if (!/^\//.test(path)) {
+        path = addCurrentDirPrefix(path)
+      }
@yusukebe
Copy link
Member

Hi @charlyoleg2

We may add supporting it.

Related to: honojs/hono#3108 #78

@DoWhileGeek
Copy link

@yusukebe I just ran into the absolute path issue as well 😅

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

3 participants