How gmboknat/ng5-tour-of-heroes works
Project type and purpose
• This is a single‐page front-end application built with Angular (version 1.6.2 of the Angular CLI).
• It’s a demonstration “Tour of Heroes” app that lets users view, search, and edit a list of heroes.
• There is no real back-end server—the InMemoryDataService simulates HTTP calls.
File structure
• Top-level files and folders:
• angular-cli.json, tsconfig.json, tslint.json, package.json, etc. — Angular build/config files
• e2e/ — end-to-end tests (Protractor)
• src/ — application source code
• Within src/:
• app/ — main application code
– app.module.ts & app-routing.module.ts — root module and router setup
– app.component.* — root component
– dashboard/, heroes/, hero-detail/, hero-search/, messages/ — feature components
– hero.service.ts, message.service.ts, in-memory-data.service.ts — services
– hero.ts, mock-heroes.ts — domain model & sample data
• assets/ — static files
• environments/ — dev/prod configuration
• main.ts, polyfills.ts, index.html, styles.css — Angular bootstrap and global assets
• Testing files:
• *.spec.ts in app/ for unit tests (Karma)
• e2e/ for integration tests
README for additional insights
• Confirms Angular CLI usage for scaffolding, serving, building, and testing.
a. Main components
• UI layer (Components & Modules)
• Application module & router
• Services layer (HeroService, MessageService, InMemoryDataService)
• Angular core & platform (BrowserModule, HttpClientModule)
• In-memory web API (simulated data store)
• Environment configs
• Testing frameworks (Karma, Jasmine, Protractor)
b. Relationships and interactions
• User → AppComponent → FeatureComponents (Dashboard, Heroes, HeroDetail, HeroSearch, Messages)
• FeatureComponents inject HeroService or MessageService → HttpClient → InMemoryDataService
• AppRoutingModule directs navigation among feature components
• InMemoryDataService intercepts HTTP calls → returns Observable<Hero[]>
c. Architectural patterns and design principles
• Component-based UI (presentation layer)
• Dependency injection for services
• Separation of concerns: presentation vs data access
• Modular routing (AppRoutingModule)
• Simulated backend via in-memory-web-api for testing/development
d. Key technologies
• Angular CLI, TypeScript, RxJS (Observables)
• @angular/core, @angular/router, @angular/common/http
• angular-in-memory-web-api
• Karma + Jasmine for unit tests, Protractor for e2e tests