https://github.com/endel/bun-serve-express
Express API compatibility layer for `Bun.serve`
https://github.com/endel/bun-serve-express
Last synced: 4 months ago
JSON representation
Express API compatibility layer for `Bun.serve`
- Host: GitHub
- URL: https://github.com/endel/bun-serve-express
- Owner: endel
- License: mit
- Created: 2023-09-12T03:34:12.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-19T10:03:42.000Z (over 1 year ago)
- Last Synced: 2025-11-06T04:10:21.339Z (7 months ago)
- Language: TypeScript
- Size: 53.7 KB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bun.serve + Express
Express API compatibility layer for `Bun.serve`. Highly similar to [uWebSockets-express](https://github.com/colyseus/uWebSockets-express/).
## Usage
```typescript
import bunExpress from "bun-serve-express";
const app = bunExpress(/* optional serve options */);
// use existing middleware implementations!
app.use(express.json());
app.use('/', serveIndex(path.join(__dirname, ".."), { icons: true, hidden: true }))
app.use('/', express.static(path.join(__dirname, "..")));
// register routes
app.get("/hello", (req, res) => {
res.json({ hello: "world!" });
});
app.listen(8000);
```
## License
MIT