Skip to content

Latest commit

 

History

History
97 lines (71 loc) · 2.14 KB

File metadata and controls

97 lines (71 loc) · 2.14 KB

FastAPI Hello World App

Welcome to the FastAPI Hello World App! This simple application is designed to demonstrate the basics of building a web API using FastAPI.

Table of Contents

Introduction

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.

Features

  • 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.

Installation

To get started, you will need to have Python 3.12 installed. Then, follow these steps:

  1. Clone the repository:

    git clone https://github.com/yourusername/fastapi-hello-world-app.git
    cd fastapi-hello-world-app
    
  2. Install Poetry, if you haven't already:

    pip install poetry
  3. Use Poetry to install the dependencies:

    poetry install

Usage

Running the Application

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.

Development

If you want to contribute to the project or set up a development environment, follow these steps:

  1. Install the development dependencies:

    poetry install --with dev
  2. Run the tests:

    poetry run pytest

Pre-commit Hooks

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

Code Formatting and Linting

  • 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/
```.