PROJET DE BOUT EN BOUT : CRÉER UNE LISTE DE TÂCHES DÉCENTRALISÉE
Construisons une application complète depuis zéro.
CONFIGURATION DU PROJET :
1. Installer dfx
2. Créer le projet : dfx new todo-app
3. Choisir Motoko ou Rust
4. Configurer dfx.json
CANISTER BACKEND :
acteur TodoApp {
stable var todos: [(Nat, Text, Bool)] = [];
stable var 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 () {