npm installnpm run serveto serve the Angular app onlocalhost:4200without service workers
Service workers augment the traditional web deployment model and empower applications to deliver a user experience with the reliability and performance on par with code that is written to run on your operating system and hardware. Adding a service worker to an Angular application is one of the steps for turning an application into a Progressive Web App (also known as a PWA). Continue reading...
In order to deliver a good experience, we must ensure the app also works without service workers.
For service workers to be registered, the application must be accessed over HTTPS or accessed via localhost
npm run watchto watch and build the project on change or justnpm run buildto build oncenpm run startto start thehttp-server- Access the app on
localhost:8080
We adhere to the structure as described in this article
-
src/appfolder: This folder contains all the application-specific code. -
src/app/corefolder: This folder contains the code that is shared across the entire application, such as services, models, guards, and interceptors. Thecore.module.tsfile is responsible for importing and exporting these shared items. -
src/app/modulesfolder: This folder contains the feature modules of the application. Each feature module is organized into its own folder, which contains all the components, services, and routing information for that feature. The naming convention for feature modules is typically [feature-name].module.ts. Use lazy loading to load modules on-demand, improving the performance of the application and reducing the initial loading time. -
src/app/sharedfolder: This folder contains shared components, directives, and pipes that are used across the application. Theshared.module.tsfile is responsible for importing and exporting shared items, for instanceTranslateModule.forChild(). -
src/assetsfolder: This folder contains static files used in the application, such as images, fonts, and stylesheets. The config.json file can also be stored here to hold any configuration data.
We use PrimeNG as UI suite for this project. Theming is also handled by PrimeNG and can be changed by the following steps:
- Navigate to
src/assets/themes/mythemeand make your changes - Run
npm run themeto generate thetheme.cssfile (which is already imported in/styles.sass)