{"id":19316085,"url":"https://github.com/lahcenezzara/bmi-calculator-fastapi","last_synced_at":"2026-04-17T10:05:22.588Z","repository":{"id":249281026,"uuid":"831087421","full_name":"LahcenEzzara/bmi-calculator-fastapi","owner":"LahcenEzzara","description":"BMI Calculator FastAPI Python","archived":false,"fork":false,"pushed_at":"2024-07-19T16:23:30.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-06T03:43:32.053Z","etag":null,"topics":["api","backend","bmi-calculator","body-mass-index","cors","fastapi","fitness","health","microservices","pydantic","python","rest-api","uvicorn","web-api","web-development"],"latest_commit_sha":null,"homepage":"https://bmi-calculator-fastapi.onrender.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LahcenEzzara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-19T16:19:17.000Z","updated_at":"2024-07-19T16:35:38.000Z","dependencies_parsed_at":"2024-07-19T21:31:46.079Z","dependency_job_id":null,"html_url":"https://github.com/LahcenEzzara/bmi-calculator-fastapi","commit_stats":null,"previous_names":["lahcenezzara/bmi-calculator-fastapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LahcenEzzara%2Fbmi-calculator-fastapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LahcenEzzara%2Fbmi-calculator-fastapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LahcenEzzara%2Fbmi-calculator-fastapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LahcenEzzara%2Fbmi-calculator-fastapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LahcenEzzara","download_url":"https://codeload.github.com/LahcenEzzara/bmi-calculator-fastapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240418044,"owners_count":19798117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","backend","bmi-calculator","body-mass-index","cors","fastapi","fitness","health","microservices","pydantic","python","rest-api","uvicorn","web-api","web-development"],"created_at":"2024-11-10T01:09:50.304Z","updated_at":"2026-04-17T10:05:22.544Z","avatar_url":"https://github.com/LahcenEzzara.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BMI Calculator FastAPI\n\nThis is a simple Body Mass Index (BMI) calculator API built with FastAPI. It calculates BMI based on user-provided weight and height, and returns a message and image indicating the BMI category.\n\n## Features\n\n- Calculate BMI using weight and height\n- Return BMI value, message, and image representing the BMI category\n- CORS setup to allow requests from web browsers\n\n## Endpoints\n\n- **GET /**: Returns a welcome message.\n- **GET /calculate_bmi**: Calculates BMI based on query parameters `weight` and `height`.\n\n## Getting Started\n\n### Prerequisites\n\n- Python 3.7+\n- FastAPI\n- Uvicorn\n- Pydantic\n\n### Installation\n\n1. Clone the repository:\n    ```bash\n    git clone https://github.com/LahcenEzzara/bmi-calculator-fastapi.git\n    cd bmi-calculator-fastapi\n    ```\n\n2. Create and activate a virtual environment:\n    ```bash\n    python -m venv venv\n    source venv/bin/activate  # On Windows, use `venv\\Scripts\\activate`\n    ```\n\n3. Install the required packages:\n    ```bash\n    pip install fastapi uvicorn pydantic\n    ```\n\n### Running the Server\n\n1. Start the FastAPI server using Uvicorn:\n    ```bash\n    uvicorn app:app --reload\n    ```\n\n2. The API will be available at `http://127.0.0.1:8000`.\n\n### Usage\n\n- **GET /**:\n    ```bash\n    curl -X 'GET' \\\n      'http://127.0.0.1:8000/' \\\n      -H 'accept: application/json'\n    ```\n    Response:\n    ```json\n    {\n      \"message\": \"Hello, Python\"\n    }\n    ```\n\n- **GET /calculate_bmi**:\n    ```bash\n    curl -X 'GET' \\\n      'http://127.0.0.1:8000/calculate_bmi?weight=70\u0026height=1.75' \\\n      -H 'accept: application/json'\n    ```\n    Response:\n    ```json\n    {\n      \"bmi\": 22.857142857142858,\n      \"message\": \"You have a normal weight, keep it up.\",\n      \"image\": \"2\"\n    }\n    ```\n\n## Acknowledgements\n\n- FastAPI\n- Pydantic\n- Uvicorn\n\n## Copyright\n\nThis project is developed by Lahcen Ezzara and is protected under the MIT License. Please see the [LICENSE](LICENSE) file for more details.\n\n**© 2024 Lahcen Ezzara. All rights reserved.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flahcenezzara%2Fbmi-calculator-fastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flahcenezzara%2Fbmi-calculator-fastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flahcenezzara%2Fbmi-calculator-fastapi/lists"}