In which kind of lib do …

less than 1 minute read

In which kind of lib do you all put things like guards, resolvers, and interceptors. Guards and Resolvers might use data access hence we cannot put them into an utility lib…


that is a good question… if I am only using the guard or resolver in one spot (a specific routing module) then i include it in that library itself (in the case of lazy loaded features).

What do you do if you need it in several features in the same scope?

Create a shared library for it in that scope, I have been tagging it as scope:util though :see_no_evil:

I’ve been using @app/auth-shared for things like this. It can be consumed by any other lib that needs it

For instance @app/auth-pages where I have my login pages, but also any other places where I want to protect routes like @app/feature-pages

This is an example of what I’m currently using, it seems to do everything I need.

Inject a data access service with a common interface then provide it in your application for the guard to use?