Constructor for initializing the server application.
It sets up the Express application instance, initializes the counter for hot restarts, sets the maximum number of allowed hot restarts, and starts the server.
Restarts the application and server by stopping the current instance and starting a new one. If the number of restarts exceeds the defined maximum hot restarts threshold, the application forcibly shuts down.
No return value.
Starts the application by performing the necessary initialization steps such as resolving network addresses, logging initial status, and initializing dependency injection.
This method does not return a value.
Starts the server by binding it to the specified port and initializing the application. Sets up a listener for incoming connections and keeps track of active connections.
Does not return a value.
Stops the application by invoking the onDestroy
method on all instances where applicable.
It retrieves all injected instances and checks for the presence of an onDestroy
method.
If found, the method is executed for proper cleanup.
Does not return a value.
Stops the server and closes all active connections. Ensures that all current connections are properly ended before shutting down the server. Handles the case where the server instance exists by closing it gracefully.
No value is returned.
The Bootstrap class is responsible for initializing, starting, stopping, and restarting the application server. It manages the server lifecycle, client connections, and application initialization. It also provides a mechanism for handling hot restarts.