- Clone the repository.
- Customize the
server.conf
file for Nginx, or remove it if not needed. - Execute the
start.sh
script to automate the setup of a virtual environment and install dependencies.
This Flask-based web application serves as a powerful API for translating \frac{3}{2}
translates to ((3)/(2))
, streamlining input for popular calculator interfaces.
-
Flask Framework: Utilizes Flask for a lightweight and flexible web application architecture, enabling low latency interaction.
-
Advanced Logging Mechanism: Implements a dual logging system with separate log files for general and error logs, enhancing traceability and debugging. Logs include timestamps and performance statistic for improved context.
-
Automated Dependency Management: The
start.sh
script seamlessly manages the creation of a virtual environment and installation of required packages fromrequirements.txt
. It intelligently prompts for missing components like Python andpip
, ensuring a smooth setup process. -
Multi-Endpoint Architecture: Supports both browser and HTTP POST requests, with dedicated endpoints for each. The
/translate
endpoint processes JSON payloads for LaTeX translations and logs performance metrics, while also serving a user-friendly translation page for interactive use. -
Parallel Processing: Uses Gunicorn to run multiple worker processes, allowing for concurrent handling of translation requests and optimizing response times under load.
- GitHub Actions automatically runs unit tests whenever changes are pushed to GitHub. This ensures that the codebase remains functional and reliable while quickly identifying any issues introduced by recent changes. The most recent status of those tests are right below.
-
Index Route (
/
): Serves the main HTML interface for user interactions. -
Translation Endpoint (
/translate
):- POST: Accepts JSON input for LaTeX expressions, configurable through various settings to optimize output. Execution time and the original request are logged for performance insights.
- GET: Renders a dedicated translation page for user-friendly LaTeX input.
- OPTIONS: Responds to CORS preflight requests, enabling checks for permissions before processing more complex requests.
The application includes error handling to provide helpful messages when issues arise, along with sorted logging to capture details for later review, contributing to a smooth user experience.
Nginx functions as a reverse proxy, routing incoming traffic to the Flask application. The Flask app processes requests through the local translateLatex
module and returns complete responses, ensuring efficient resource utilization and scalability.