How gonzalostickar/practicaprofesional works
Main Components
a. Frontend (Views/Components):
• The "components" directory contains various .htm files used for the UI. It includes pages for login, dashboard (with subdirectories for adding, searching, etc.), and static pages like "politica_privacidad.htm" and "terminos_condiciones.htm".
• The "public" folder holds static assets (e.g., CSS stylesheets, JavaScript scripts, images).
b. Backend:
• Controllers: The "controllers" directory comprises the core business logic. There are separate modules for handling login, main operations, and different CRUD operations (adding, searching, editing, deleting, and generating reports) in its "crud" subdirectory, along with others for dashboard functionality.
• Routes: The "routes" folder mirrors the controllers with endpoints for the various functionalities. Each route file (e.g., routes/consultas.js, routes/crud/agregar.js, etc.) connects HTTP requests to the appropriate controller logic.
• Models: The "models" directory houses data representations, with separate files like persona.js and reparacion.js for your domain entities. The "models/sql" subdirectory along with schema.sql indicates that the project uses SQL for the database.
• Data & Database: Files like "data/db.js" and "database.js" suggest that there is a database connection/initialization layer, which might be used by the models and controllers.
c. Middlewares & Helpers:
• The "middlewares" folder contains modules for caching and authentication (e.g., isAuth.js), which regulate access and optimize performance.
• The "helpers" folder includes utility functions like date formatting (dateHelper.js).
Relationships and Interactions
• Flow starting from the client: a user interacts with the UI presented in static webpages (from the "components" and "public" directories).
• HTTP requests are made to routes defined in the "routes" directory.
• Routes pass these requests to the relevant controllers that implement business logic.
• Controllers interact with the models (and, in turn, the database) to fetch, update, or delete the necessary data.
• Middleware components (like “isAuth.js” and “cache.js”) process requests before they reach the controller, ensuring authentication and performance optimizations.
• Finally, responses are returned back through the routes to be rendered in the user’s browser.
Architectural Patterns & Key Technologies
• MVC or similar layered architecture divides the application into distinct concerns (views, controllers, models).
• The CRUD operations are modularized in both the controllers and routes (for adding, searching, editing, and deleting data).
• The project uses Node.js (suggested by package.json, index.js) for server-side logic.
• SQL-based database is indicated by the schema.sql in models/sql.
• Deployment on Vercel is indicated via vercel.json and the README.
– From “Frontend” to “API Routes” indicating HTTP requests.
– From “API Routes” through “Middlewares” to “Controllers”.
– From “Controllers” to “Models/Database” for data operations.
• Entry point ("index.js") as a starting node that ties all components together when the application starts.
Details and Design Principles
• Modularization especially in the CRUD operations and the separation of concerns.