Where is the best location to place HttpInterceptors?
I was wondering where the best location might be to place classes that inherit from HttpInterceptor? I am have interceptors for logging, caching, authorization, etc. Would these be appropriate in CoreModule? Same question for route guards. Thanks!
Both HTTP interceptors and route guards belong in the CoreModule. Singleton services that are instantiated once and used across the entire app. Interceptors and guards are: -Application-wide -Singleton by design -Infrastructure-level (not feature-specific) -Registered once (or should be) That makes them a perfect fit for CoreModule.
Great question! The Angular 2+ style guide in this repo defers to the official Angular style guide maintained by the Angular team at https://angular.dev/style-guide — that's the best place for current Angular (2+) and TypeScript conventions. Closing this here, but the official guide should cover this well. 🙏