Testing the PWA capabilities
In this section, we’ll try to test the service worker registration for our
HealthCheck app. Unfortunately, doing it from a Visual Studio development environment is a rather complex task for several reasons, including the following:
ng serve, the Angular CLI command that pre-installs the packages and starts the app whenever we run our app in debug mode, doesn’t support service workers
- The service worker registration tasks that we put in the
AppModuleclass a while ago only register it when the app is running in a production environment
- The required static files generated by the Angular CLI using the
angular.jsonconfiguration file that we modified earlier on will only be available in production environments
However, we can easily work around these limitations by compiling our Angular app for production and then running the generated files with a separate, dedicated HTTP server.
In the following sections...