For example, if the url is not match to any API endpoint, we want to return 404 error message. So first thing, we want to send the request to the server first. If got the response, then we just return it back. self.addEventListener('fetch', (event) =…