How cavanosa/tutorial_jwt_front works
Main Components
• UI Components: Different components correspond to various pages or features. For example:
• Authentication: Login (src/app/auth/login.component.ts) and Registration (src/app/auth/registro.component.ts).
• Products Management: Components for listing, detailing, editing, and creating products (e.g., src/app/producto/lista-producto.component.ts, detalle-producto.component.ts, etc.).
• Index & Menu: The index page (src/app/index/index.component.ts) and menu component (src/app/menu/menu.component.ts).
• Services Layer: Introduce a “Services” component that encapsulates service files (src/app/service/auth.service.ts, producto.service.ts, token.service.ts) which handle business logic, API interactions, and communication.
• Architectural Utilities:
• Guards: Security and navigation guards (src/app/guards/prod-guard.service.ts) protecting routes.
• Interceptors: HTTP interceptors (src/app/interceptors/prod-interceptor.service.ts) for modifying outbound requests, e.g., appending tokens.
• Models: Data models (DTOs) under src/app/models/ for standardizing API request/response formats.
• Configuration & Build: Files like angular.json, package.json, and environment configurations (src/environments) indicate the project’s build and deployment workflows.
Relationships and Interactions
• The Services Layer should show interactions with external APIs (even if these are abstracted in this project) and the Models acting as the data contracts.
• That Guards and Interceptors are attached to the routing and service calls respectively by showing them intercepting data flows or protecting routes.
Architectural Patterns
• “Separation of Concerns”: Observe the clear divide between presentation (components), business logic (services), and security (guards, interceptors).
• “MVC (or MVVM) Pattern”: Even though Angular internally manages a component-based architecture, the structure can be thought of in layers – with components handling view rendering and services/models handling data and domain logic.
• “Client-Side Routing”: Emphasis on Angular routing (via app-routing.module.ts) demonstrates the client-managed page transitions and state management.
Relevant Technologies
• Angular CLI: The entire project is scaffolded by Angular CLI.
• Testing Frameworks: Karma for unit testing and Protractor for end-to-end testing are part of the development process.
• TypeScript: As all development is in TypeScript, note down its role in ensuring type safety.
• Build Tools & Configurations: Angular.json and tsconfig files represent build and compiler settings.
• Use clear, distinct labels for each component (e.g., “Auth Module”, “Producto Module”, “Main App”).
• From user interactions in UI Components to Services.
• From Services back to UI, showing async data updates.
• Between the Routing Module and individual components.
• Rectangles for components such as login, product listing, etc.
• Ovals or circles for services and utilities (guards, interceptors).