node:http and node:https modules that Express relies on.
See the Node.js compatibility page for detailed information about which Node.js APIs Bun supports.
Setup
1
Install Express
2
Create a server
src/server.ts
3
Run the server
Routing
Express routing works identically on Bun:Middleware
Express middleware functions work the same way:Performance notes
Express on Bun is faster than Express on Node.js because Bun’s HTTP implementation is more efficient. However, if you are starting a new project and do not need Express compatibility, Bun’s nativeBun.serve() API or a Bun-native framework like Elysia or Hono will provide better performance.
- Express (Node.js compat)
- Bun.serve (native)