Bun Middleware

Qwik Router Bun middleware allows you to hook up Qwik Router to a Bun server which uses the Bun Http API.

Installation

To install bun on Linux, OSX or WSL run the following command in your terminal

curl -fsSL https://bun.sh/install | bash 

For other platforms or if you run into issues with installation, up to date bun installation instructions can be found on the bun website.

If you run into the error Something went wrong installing the "sharp" module when using bun as a package manager, add the following code to your package.json, then remove the node_modules folder and any lockfiles such as bun.lockb or package-lock.json. Then run bun install.

"trustedDependencies": [ 
  "sharp"
]

This issue is currently being tracked on the bun repository.

To integrate the bun adapter, use the add command:

bun run qwik add bun

Production build

To build the application for production, use the build command, this command will automatically run bun run build.server and bun run build.client:

bun run build

Serve

To start the Bun server after a build:

bun run serve

Production deploy

Since you are choosing Bun, here you are in your own, after running bun run build:

  • The dist folder will be created including all the static files.
  • The server folder will be created including all bun server files.

Contributors

Thanks to all the contributors who have helped make this documentation better!

  • EamonHeffernan