Overview
The Jhonny Diaz Portfolio is designed as a single-page application with no client-side routing. All sections (Header, Hero, About, Projects, Contact, Footer) are rendered on a single page without navigation between different routes. However, the application includes routing configuration files for future extensibility and server-side rendering (SSR) support.Client-Side Routing
Routes Configuration
The client-side routes are defined inapp.routes.ts:
- The
routesarray is empty ([]) - No route navigation is configured
- The application renders a single page layout
Application Configuration
Routing is registered in the application configuration:provideBrowserGlobalErrorListeners()- Global error handlingprovideZonelessChangeDetection()- Modern zoneless change detection for better performanceprovideRouter(routes)- Router configuration (currently empty routes)provideClientHydration(withEventReplay())- SSR hydration with event replay
Zoneless Change Detection is a modern Angular feature that improves performance by eliminating Zone.js dependency. The application uses signals and explicit change detection instead.
Server-Side Routing
Server Routes Configuration
The server-side routes are defined inapp.routes.server.ts:
path: '**'- Matches all routes (wildcard)RenderMode.Prerender- Prerenders the HTML at build time
Render Modes
Angular SSR supports three render modes:Prerender
Generates static HTML at build timeBest for: Static content, SEO
Server
Renders HTML on the server per requestBest for: Dynamic content
Client
Renders in the browser onlyBest for: Client-side apps
This portfolio uses Prerender mode because the content is static and doesn’t require server-side rendering per request. This provides the best performance and SEO benefits.
Single-Page Architecture
Why No Routing?
The portfolio is intentionally designed as a single-page application:Better User Experience
Better User Experience
Users can scroll through all sections smoothly without page reloads or navigation clicks.
Simpler Navigation
Simpler Navigation
Faster Load Times
Faster Load Times
All content loads once, eliminating the need for subsequent route-based loads.
Portfolio-Appropriate
Portfolio-Appropriate
Most portfolio websites benefit from a single-page layout showcasing all information at once.
Section-Based Navigation
Instead of route-based navigation, the portfolio uses section IDs for smooth scrolling:Future Extensibility
While the current implementation has no routes, the routing infrastructure is in place for future expansion.Adding Routes
To add client-side routing in the future:SSR and Hydration
The application is configured for server-side rendering:Build Configuration
Inangular.json:
Hydration with Event Replay
The application useswithEventReplay() for hydration:
- Captures user events during hydration
- Replays events after the app becomes interactive
- Prevents event loss during the SSR-to-client transition
Best Practices
Lazy Loading (Future)
Lazy Loading (Future)
When adding routes, use lazy loading for better performance:
Route Guards
Route Guards
Protect routes with guards for authentication or authorization:
Prerendering Strategy
Prerendering Strategy
Use
RenderMode.Prerender for static pages and RenderMode.Server for dynamic content.