How andresrojas0/contenido-dinamico-api-fetch works
Project Type and Purpose
• This project is a simple front-end application created as a class practice exercise (Python Fullstack - Clase 27) to demonstrate how to use the API Fetch method for accessing remote resources and dynamically injecting them into a web document.
• The focus is entirely on the client side using HTML, CSS, and JavaScript, without a dedicated backend or database layer.
Analyzing the File Structure
• Top-level files and directories include:
• README.md (project documentation)
• index.html (main landing page)
• css/estilos.css (styling information)
• js/ (contains JavaScript modules, including:
• api-fetch-asincro.js (async API fetch implementation)
• api-fetch-sincro.js (sync API fetch implementation)
• ruteo.js (handles routing/navigational logic)
)
• sitio/ (contains additional HTML pages for other sections, such as datos.html and inicio.html)
• The file organization suggests a clear separation between presentation (HTML), styling (CSS), and behavior (JavaScript), with possible routing between different sections of the site.
a. Presentation Layer:
• Main HTML Files: index.html and the pages under sitio/ (inicio.html, datos.html)
• Styling: css/estilos.css, which applies design rules across the pages.
b. Behavior Layer:
• JavaScript files:
• api-fetch-asincro.js: Handles asynchronous API calls.
• api-fetch-sincro.js: Handles synchronous API calls (if applicable in a demo context).
• ruteo.js: Manages routing between different HTML views/pages.
c. Data Access:
• API Calls: Illustrate how the JavaScript files interact with external resources via the fetch API.
d. Hosting Environment:
• Although the project is client-centric, include an element that represents the web server (or static web hosting environment such as Netlify, as mentioned in the README) from which the pages are served.
Relationships and Interactions
• That the JavaScript API fetch modules are responsible for retrieving external data and updating the DOM accordingly.
• The CSS file connects to all HTML pages to provide consistent styling.
• Routing mechanism managed by ruteo.js, enabling navigation between index.html and the additional pages in the sitio/ folder.
Architectural Patterns and Technologies
• The project follows a clear separation of concerns:
• Structure (HTML),
• Presentation (CSS), and
• Behavior (JS modules for API calls and client-side routing).
• For API fetches: from the client-side JavaScript to "External API."
• For navigation: showing how ruteo.js handles transitions between different site sections.