node-server icon indicating copy to clipboard operation
node-server copied to clipboard

add support for absolute path to serveStatic root

Open charlyoleg2 opened this issue 6 months ago • 2 comments

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)
+      }

charlyoleg2 avatar Aug 17 '24 00:08 charlyoleg2