Handles system exit signals and closes the server gracefully.
Resolves #52
I remove the callback from the listeners as -by experience- the callback sometimes needlessly gets called several times if not removed after first call.
I have added await on server.stop() as it returns a promise in Bun 1.1.30. This is also backwards compatible with older versions as await is a no-op for normal functions.
Handles system exit signals and closes the server gracefully.
Resolves #52
I remove the callback from the listeners as -by experience- the callback sometimes needlessly gets called several times if not removed after first call.