I built an app where the port number of the API can be configured. The user can set a new port number. If the port number is not valid, the API call will hang for 100 seconds! I wanted to introduce a feature where the API call times out in 10 seconds.
Before I started to work on this task, I did not know that the fetch specification does not have a timeout option.…