method
bun.Server.reload
Update the fetch and error handlers without restarting the server.
// create the server
const server = Bun.serve({
fetch(request) {
return new Response("Hello World v1")
}
});
// Update the server to return a different response
server.reload({
fetch(request) {
return new Response("Hello World v2")
}
});Passing other options such as port or hostname has no effect.