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 · 3 comments · May be fixed by #202
Open

add support for absolute path to serveStatic root #187

charlyoleg2 opened this issue Aug 17, 2024 · 3 comments · May be fixed by #202

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 😅

@charlyoleg2
Copy link
Author

charlyoleg2 commented Sep 28, 2024

The hono's release 4.3.6 supports absolute path for serveStatic. Now node-server must forward the path without modifying it. This will enable the feature working in nodejs.
The current release 1.13.1 of node-server prefixes the path with './'. This prevents the use of absolute path.

@yusukebe yusukebe linked a pull request Sep 30, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants