Ajout de la documentation et de la configuration Backstage.io
This commit is contained in:
parent
3a168404ca
commit
d62d1e91a0
17
catalog-info.yaml
Normal file
17
catalog-info.yaml
Normal file
@ -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
|
||||||
23
docs/api-reference.md
Normal file
23
docs/api-reference.md
Normal file
@ -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.
|
||||||
53
docs/getting-started.md
Normal file
53
docs/getting-started.md
Normal file
@ -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
|
||||||
20
docs/index.md
Normal file
20
docs/index.md
Normal file
@ -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)
|
||||||
11
mkdocs.yml
Normal file
11
mkdocs.yml
Normal file
@ -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
|
||||||
Loading…
x
Reference in New Issue
Block a user