serve-static-bun icon indicating copy to clipboard operation
serve-static-bun copied to clipboard

Serve static files using Bun.serve or Bao.js

Results 7 serve-static-bun issues
Sort by recently updated
recently updated
newest added

Currently if i provide an absolute path it's added to the end of the `process.cwd()` which is not what i was expecting at all. 🤔

Why there's a need to add `process.cwd()`? Give us the freedom to use absolute path... https://github.com/jakobbouchard/serve-static-bun/blob/7ed89cd0d142844f73ac158b0fcb351553cc89dc/src/serve-static.ts#L236C1-L236C36 I can't do like this because of that `process.cwd()` as root prefix.. ```ts import...

use absolute path instead. ```ts import path from "path"; import Bao from "baojs"; import serveStatic from "serve-static-bun"; const app = new Bao(); const staticFolder = path.join( import.meta.dir, // Absolute path...

```ts import serveStatic from 'serve-static-bun'; const serve = serveStatic('.', { collapseSlashes: true, }); Bun.serve({ port: 3000, fetch: serve, }); ``` ```ts ➜ bun-rsc git:(main) ✗ bun run ./src/file.ts Response (4.50...

Non-exhaustive list of options to add (mostly from serve-static) - [x] `dotfiles` - [ ] `acceptRanges` - [ ] `lastModified` Options that are not considered or a not priority: -...

enhancement

If root is an absolute path, don't append cwd to it

This PR adds proper MIME type support - this is extra important these days because most browsers will refuse to load CSS/JS served with text/plain: ![image](https://github.com/user-attachments/assets/4b5fe521-e8ff-4d31-b336-ef26b21ffae0)