From d62d1e91a0a48ba4a374bae7b899e702508eb960 Mon Sep 17 00:00:00 2001 From: spham Date: Sun, 8 Jun 2025 00:14:33 +0200 Subject: [PATCH] Ajout de la documentation et de la configuration Backstage.io --- catalog-info.yaml | 17 +++++++++++++ docs/api-reference.md | 23 ++++++++++++++++++ docs/getting-started.md | 53 +++++++++++++++++++++++++++++++++++++++++ docs/index.md | 20 ++++++++++++++++ mkdocs.yml | 11 +++++++++ 5 files changed, 124 insertions(+) create mode 100644 catalog-info.yaml create mode 100644 docs/api-reference.md create mode 100644 docs/getting-started.md create mode 100644 docs/index.md create mode 100644 mkdocs.yml diff --git a/catalog-info.yaml b/catalog-info.yaml new file mode 100644 index 0000000..0ce9fe6 --- /dev/null +++ b/catalog-info.yaml @@ -0,0 +1,17 @@ +apiVersion: backstage.io/v1alpha1 +kind: Component +metadata: + name: fastapi-service + description: A simple FastAPI service + annotations: + github.com/project-slug: fastapi-service + backstage.io/techdocs-ref: dir:./docs + tags: + - fastapi + - python + - api +spec: + type: service + lifecycle: experimental + owner: user-team + system: web-services diff --git a/docs/api-reference.md b/docs/api-reference.md new file mode 100644 index 0000000..0b6e539 --- /dev/null +++ b/docs/api-reference.md @@ -0,0 +1,23 @@ +# API Reference + +## Endpoints + +### GET / + +Returns a simple greeting message. + +**Response** + +```json +{ + "message": "Hello, Docker!" +} +``` + +## Request and Response Formats + +All API responses are in JSON format. + +## Error Handling + +The API uses standard HTTP status codes to indicate the success or failure of requests. diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 0000000..79440ac --- /dev/null +++ b/docs/getting-started.md @@ -0,0 +1,53 @@ +# Getting Started + +## Prerequisites + +- Docker +- Python 3.7+ + +## Installation + +1. Clone the repository +2. Build the Docker image: + +```bash +docker build -t fastapi-service . +``` + +3. Run the container: + +```bash +docker run -p 8000:8000 fastapi-service +``` + +## Development + +To set up a development environment: + +1. Create a virtual environment: + +```bash +python -m venv venv +source venv/bin/activate # On Windows: venv\Scripts\activate +``` + +2. Install dependencies: + +```bash +pip install -r requirements.txt +``` + +3. Run the application: + +```bash +uvicorn main:app --reload +``` + +The API will be available at http://localhost:8000. + +## API Documentation + +FastAPI provides automatic interactive API documentation. Once the server is running, you can access: + +- Swagger UI: http://localhost:8000/docs +- ReDoc: http://localhost:8000/redoc diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..4410974 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,20 @@ +# FastAPI Service + +## Overview + +This is a simple FastAPI service that provides a basic API endpoint. The service is containerized using Docker for easy deployment. + +## Features + +- Simple REST API with FastAPI +- Docker containerization +- Easy to extend and modify + +## Architecture + +The service is built using FastAPI, a modern, fast web framework for building APIs with Python. + +## Documentation + +- [API Reference](api-reference.md) +- [Getting Started](getting-started.md) diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..27694c7 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,11 @@ +site_name: 'FastAPI Service' +nav: + - Home: index.md + - API Reference: api-reference.md + - Getting Started: getting-started.md +plugins: + - techdocs-core +markdown_extensions: + - admonition + - pymdownx.highlight + - pymdownx.superfences