Welcome to the FastAPI Hello World App! This simple application is designed to demonstrate the basics of building a web API using FastAPI.
This project is a minimal FastAPI application that serves a "Hello, World!" message. It is intended as a starting point for learning how to use FastAPI to build web applications and APIs.
- FastAPI for building APIs.
- Example endpoint that returns a "Hello, World!" message.
- Configuration for development tools like Black, Pre-commit, Flake8, Pytest, Mypy, and Isort.
To get started, you will need to have Python 3.12 installed. Then, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/fastapi-hello-world-app.git cd fastapi-hello-world-app
-
Install Poetry, if you haven't already:
pip install poetry
-
Use Poetry to install the dependencies:
poetry install
Create a .env
file
cp app/.env.example app/.env
Navigate into /app
directory
cd app/
To run the application, simply execute:
poetry run fastapi run main:app --reload
By default, the application will be available at http://127.0.0.1:8000.
If you want to contribute to the project or set up a development environment, follow these steps:
-
Install the development dependencies:
poetry install --with dev
-
Run the tests:
poetry run pytest
This project uses pre-commit hooks to ensure code quality. To set up the hooks, run:
poetry run pre-commit install \
&& poetry run pre-commit install --hook-type commit-msg
- Black: Code formatting
- Ruff: Linting
- Mypy: Type checking
- Isort: Import sorting
Run these tools by executing:
```sh
poetry run black app/
poetry run ruff app/
poetry run mypy app/
poetry run isort app/
```.