مشروع كامل من النهاية إلى النهاية: أنشئ قائمة مهام لامركزية
لنقم ببناء تطبيق كامل من الصفر.
إعداد المشروع:
1. تثبيت dfx
2. إنشاء مشروع: dfx new todo-app
3. اختر Motoko أو Rust
4. إعداد ملف dfx.json
الكانستر الخلفي (BACKEND CANISTER):
عامل 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 () {