This is a simple web application that allows users to perform arithmetic calculations through a web interface. The application is built using FastAPI and Jinja2Templates for rendering HTML templates.
- Input an arithmetic expression and receive the result or an error message.
- Supports addition, subtraction, multiplication, and division operations.
- FastAPI
- Jinja2
- unittest
- TestClient
- HTML
-
Clone this repository to your local machine:
git clone https://github.com/TheLordVier/simple_calculator_on_FastAPI
-
Create and activate virtual environment:
python3 -m venv venv .venv/bin/activate (for Linux) venv\Scripts\activate (for Windows)
-
Install the required dependencies using pip:
pip install -r requirements.txt
-
Start the FastAPI application:
uvicorn calculator:app --reload
-
Open your web browser and navigate to http://127.0.0.1:8000 to access the calculator web app.
This project includes unit tests to ensure the correctness of the application's behavior.
-
Open a terminal and from the root of the project, run the following command to run the tests:
python -m unittest tests/test_calculator.py
Or just run the tests from the test_calculator.py file located in the tests directory.
This project is licensed under the MIT License.