I have a SvelteKit based application in development. On the server startup, be it on a development server boot up, Node.js adapter boot up I would like to execute some diagnostics commands. An example of such action is to ping the backend server and fail early if the backend is unreachable. This would be mostly a concern for server-side rendering, but if it is easy I would like to apply it for static deployments as well.
What would be the best hook to place in such code?
Also what would be graceful way to abort the application launch with an error message?