diff --git a/examples/api-basic-auth-middleware/basic-auth.w b/examples/api-basic-auth-middleware/basic-auth.w index ad65fa7..eecd808 100644 --- a/examples/api-basic-auth-middleware/basic-auth.w +++ b/examples/api-basic-auth-middleware/basic-auth.w @@ -50,7 +50,7 @@ pub class BasicAuth { } // force cast to str from str? - return "{authHeader}"; + return "{authHeader!}"; } else { log("headers: {Json.stringify(headers)}"); log("no auth header"); diff --git a/examples/api-basic-auth/main.w b/examples/api-basic-auth/main.w index 888b20c..38de0cf 100644 --- a/examples/api-basic-auth/main.w +++ b/examples/api-basic-auth/main.w @@ -52,7 +52,7 @@ class BasicAuth { } // force cast to str from str? - return "{authHeader}"; + return "{authHeader!}"; } else { log("headers: {Json.stringify(headers)}"); log("no auth header"); diff --git a/examples/multiplayer-videogame/main.w b/examples/multiplayer-videogame/main.w index eeade5f..286e4e8 100644 --- a/examples/multiplayer-videogame/main.w +++ b/examples/multiplayer-videogame/main.w @@ -1,6 +1,5 @@ bring cloud; bring util; -bring ex; bring expect; let website = new cloud.Website(path: "./front-end"); diff --git a/examples/react-website/main.w b/examples/react-website/main.w index f20a77f..4e7e887 100644 --- a/examples/react-website/main.w +++ b/examples/react-website/main.w @@ -1,7 +1,7 @@ bring cloud; bring util; bring http; -bring ex; +bring react; let api = new cloud.Api(); @@ -12,7 +12,7 @@ api.get("/test", inflight (req) => { }; }); -let website = new ex.ReactApp( +let website = new react.App( projectPath: "./website", useBuildCommand: true, localPort: 3002, diff --git a/examples/react-website/package.json b/examples/react-website/package.json new file mode 100644 index 0000000..db6b562 --- /dev/null +++ b/examples/react-website/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@winglibs/react": "^0.1.4" + } +} diff --git a/examples/redis/main.w b/examples/redis/main.w index 6907369..23ea9d2 100644 --- a/examples/redis/main.w +++ b/examples/redis/main.w @@ -1,20 +1,20 @@ bring cloud; -bring ex; +bring redis; bring util; bring expect; let queue = new cloud.Queue(); -let redis = new ex.Redis(); +let cache = new redis.Redis(); queue.setConsumer(inflight (message) => { - redis.set("hello", message); + cache.set("hello", message); }, timeout: 3s); test "Hello, world!" { queue.push("world!"); util.waitUntil(() => { - return redis.get("hello") != nil; + return cache.get("hello") != nil; }); - expect.equal(redis.get("hello"), "world!"); + expect.equal(cache.get("hello"), "world!"); } \ No newline at end of file diff --git a/examples/redis/package.json b/examples/redis/package.json new file mode 100644 index 0000000..7a613ab --- /dev/null +++ b/examples/redis/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@winglibs/redis": "^0.0.11" + } +} diff --git a/examples/todo-app/main.w b/examples/todo-app/main.w index 2d13ea5..f5f0c11 100644 --- a/examples/todo-app/main.w +++ b/examples/todo-app/main.w @@ -1,8 +1,8 @@ bring cloud; -bring ex; bring util; bring http; bring expect; +bring redis; enum Status { PENDING, COMPLETED @@ -73,17 +73,17 @@ let convertTaskArrayToJson = inflight (taskArray: Array): Json => { ********************************************************************/ class TaskStorage impl ITaskStorage { - db: ex.Redis; + db: redis.Redis; counter: cloud.Counter; new() { - this.db = new ex.Redis(); + this.db = new redis.Redis(); this.counter = new cloud.Counter(); } inflight _add(id: str, j: Json) { this.db.set(id , Json.stringify(j)); - this.db.sadd("tasks", id); + this.db.sAdd("tasks", id); } pub inflight add(description: str): str { @@ -120,8 +120,8 @@ class TaskStorage impl ITaskStorage { pub inflight find(r: IRegExp): Array { let result = MutArray[]; - let ids = this.db.smembers("tasks"); - for id in ids { + let ids = this.db.sMembers("tasks"); + for id in ids ?? [] { if let taskJsonStr = this.db.get(id) { let taskJson = Json.parse(taskJsonStr); if r.test(taskJson.get("description").asStr()) { diff --git a/examples/todo-app/package.json b/examples/todo-app/package.json new file mode 100644 index 0000000..7a613ab --- /dev/null +++ b/examples/todo-app/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@winglibs/redis": "^0.0.11" + } +}