END-TO-END-PROJEKT: BAUE EINE DEZENTRALE TODO-LISTE
Lass uns eine komplette Anwendung von Grund auf neu erstellen.
PROJEKT-EINRICHTUNG:
1. Installiere dfx
2. Projekt erstellen: dfx new todo-app
3. Motoko oder Rust wählen
4. dfx.json konfigurieren
BACKEND-CANISTER:
Actor TodoApp {
stabile Variable todos: [(Nat, Text, Bool)] = [];
stabile Variable nextId: Nat = 0;
public func addTodo(text: Text) : async Nat {
let id = nextId;
todos := Array.append(todos, [(id, text, false)]);
nextId += 1;
return id;
};
public func completeTodo(id: Nat) : async () {