Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ToDo Manager Flask API

Ein vollständiger ToDo-Manager mit Flask REST-API, JSON-Datenspeicherung und modernem Web-Interface.

Features

  • REST API
  • JSON-Datenspeicherung in todos.json
  • Web-Interface
  • Filterfunktionen nach Status
  • Statistiken über ToDo-Verteilung
  • Unit-Tests für alle wichtigen Funktionen
  • Automatisches Speichern nach jeder Aktion

ToDo-Attribute

  • ID: Eindeutige Identifikation
  • Titel: Kurze Beschreibung der Aufgabe
  • Beschreibung: Detaillierte Beschreibung
  • Status: offen, in Bearbeitung, erledigt
  • Erstellt am: Zeitstempel der Erstellung
  • Aktualisiert am: Zeitstempel der letzten Änderung

Installation

Voraussetzungen

  • Python 3.7 oder höher
  • pip (Python Package Manager)

API Endpunkte

Basis-URL

http://localhost:5000

1. Alle ToDos abrufen

GET /todos

Beispiel:

curl http://localhost:5000/todos

Mit Status-Filter:

curl "http://localhost:5000/todos?status=offen"

2. Einzelnes ToDo abrufen

GET /todos/<id>

Beispiel:

curl http://localhost:5000/todos/1703501234567

3. Neues ToDo erstellen

POST /todos

Beispiel:

curl -X POST http://localhost:5000/todos \
  -H "Content-Type: application/json" \
  -d '{
    "titel": "Einkaufen gehen",
    "beschreibung": "Milch, Brot und Eier kaufen",
    "status": "offen"
  }'

4. ToDo bearbeiten

PUT /todos/<id>

Beispiel:

curl -X PUT http://localhost:5000/todos/1703501234567 \
  -H "Content-Type: application/json" \
  -d '{
    "titel": "Einkaufen erledigt",
    "status": "erledigt"
  }'

5. ToDo löschen

DELETE /todos/<id>

Beispiel:

curl -X DELETE http://localhost:5000/todos/1703501234567

6. Statistiken abrufen

GET /todos/statistik

Beispiel:

curl http://localhost:5000/todos/statistik

Antwort:

{
  "gesamt": 5,
  "status_verteilung": {
    "offen": 2,
    "in Bearbeitung": 1,
    "erledigt": 2
  }
}

Projektstruktur

ToDoManagerFlask/
├── app.py                 # Hauptanwendung 
├── test_todo_manager.py   # Unit-Tests
├── requirements.txt       # Abhängigkeiten
├── README.md             # Diese Datei
├── templates/            # HTML-Templates
│   └── index.html        # Web-Interface
└── todos.json            # JSON-Datenbank 

Web-Interface

  • Live-Statistiken über ToDo-Verteilung
  • Filterfunktionen nach Status
  • Inline-Bearbeitung von ToDos

JSON-Datenbank

  • Datei: todos.json
  • Automatisches Laden beim Start
  • Automatisches Speichern nach Änderungen
  • Backup-empfehlung für Produktionsumgebung

Fehlerbehandlung

Die API gibt strukturierte Fehlerantworten zurück:

{
  "error": "Fehlermeldung"
}

HTTP-Status-Codes:

  • 200: Erfolg
  • 201: Erstellt
  • 400: Ungültige Anfrage
  • 404: Nicht gefunden
  • 500: Server-Fehler

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages