How juanluismm521/uja-api works
Main Components
• Client: Represent any consumer (could be a web client or mobile app) making the POST /login requests.
• API Server: This is your Express-based Node.js server (bootstrapped in main.js). It is responsible for receiving requests and orchestrating the scraping process.
• Scraping Module: Although the file tree only shows main.js and gym.js, gym.js is likely a dedicated module that encapsulates the Puppeteer-based scrapping logic from the Platea platform.
• External Platform: The remote UJA Platea system (Platea) where the user data is scraped from.
• Docker: The existence of a Dockerfile indicates that the API server may be containerized for deployment.
Relationships and Interactions
• The Client sends a POST request to the API Server’s /login endpoint with user credentials.
• The API Server uses its Express framework to route the request and then calls the scraping module (gym.js).
• The scraping module uses Puppeteer to perform login and data extraction from the external UJA Platea website.
• Once the data is retrieved, the API Server packages the user data into a JSON response, which is then sent back to the Client.
• Optionally, the Docker container (if used) encapsulates the running Node.js API for deployment.
Architectural Patterns and Design Principles
• Modularity: Separation between the main server logic (main.js) and the scraping functionality (gym.js).
• Use of third-party libraries: It’s essential to note that Puppeteer (for scraping) and Express (for routing) are at the core of this design.
Relevant Technologies
• Node.js as the runtime environment.
• Express as the web framework.
• Puppeteer as the web scraping library.
• Docker (via Dockerfile) for containerization and deployment.
• (Package management) npm, as evident from package.json and package-lock.json.
Putting It All Together
• The routing logic handling the /login endpoint.
• The interaction with the scraping module (gym.js).