diff --git a/examples/api-basic-auth-middleware/basic-auth.w b/examples/api-basic-auth-middleware/basic-auth.w index a0c48ba..11a0121 100644 --- a/examples/api-basic-auth-middleware/basic-auth.w +++ b/examples/api-basic-auth-middleware/basic-auth.w @@ -3,7 +3,6 @@ bring cloud; pub class Utils { extern "./utils.js" pub static inflight base64decode(value: str): str; extern "./utils.js" pub static inflight base64encode(value: str): str; - init() { } } pub struct Credentials { @@ -15,7 +14,7 @@ pub class BasicAuth { user: str; password: str; - init(user: str?, password: str?) { + new(user: str?, password: str?) { this.user = user ?? "admin"; this.password = password ?? "admin"; } diff --git a/examples/api-basic-auth/main.w b/examples/api-basic-auth/main.w index d04ef80..8d46266 100644 --- a/examples/api-basic-auth/main.w +++ b/examples/api-basic-auth/main.w @@ -12,7 +12,7 @@ class BasicAuth { user: str; password: str; - init(user: str?, password: str?) { + new(user: str?, password: str?) { this.user = user ?? "admin"; this.password = password ?? "admin"; } @@ -111,6 +111,6 @@ test "authenticated" { Authorization: "Basic " + util.base64Encode("admin:admin") } }); - + expect.equal(response.status, 200); } \ No newline at end of file diff --git a/examples/api-counter-ssr/main.w b/examples/api-counter-ssr/main.w index 6f47d3a..4de3804 100644 --- a/examples/api-counter-ssr/main.w +++ b/examples/api-counter-ssr/main.w @@ -8,7 +8,6 @@ class Utils { // This is a workaround for the pending fs module // https://github.com/winglang/wing/issues/3096 extern "./utils.js" pub static readFile(filePath: str): str; - init() { } } let templates = new cloud.Bucket(); diff --git a/examples/multiplayer-videogame/main.w b/examples/multiplayer-videogame/main.w index c58bb03..1c5642c 100644 --- a/examples/multiplayer-videogame/main.w +++ b/examples/multiplayer-videogame/main.w @@ -8,7 +8,6 @@ let website = new cloud.Website(path: "./front-end"); class Utils { extern "./socket_utils.js" pub static inflight RunWebSocketServer(port:num); extern "./socket_utils.js" pub static inflight CloseWebSocketServer(port:num); - init() { } } let lock = new cloud.Counter( diff --git a/examples/provider-specific/awscdk-docker-python-lambda/main.w b/examples/provider-specific/awscdk-docker-python-lambda/main.w index 0142675..e621bc0 100644 --- a/examples/provider-specific/awscdk-docker-python-lambda/main.w +++ b/examples/provider-specific/awscdk-docker-python-lambda/main.w @@ -3,7 +3,7 @@ bring "aws-cdk-lib" as awscdk; class CdkDockerImageFunction { function: awscdk.aws_lambda.DockerImageFunction; - init() { + new() { this.function = new awscdk.aws_lambda.DockerImageFunction({ code: awscdk.aws_lambda.DockerImageCode.fromImageAsset("./container"), }); diff --git a/examples/stock-poller/main.w b/examples/stock-poller/main.w index 80bbcd6..e9073e5 100644 --- a/examples/stock-poller/main.w +++ b/examples/stock-poller/main.w @@ -6,7 +6,7 @@ let tickerSymbol = "GME"; class TwelveDataApi { key: cloud.Secret; - init() { + new() { this.key = new cloud.Secret( name: "twelve-data-api-key" ); diff --git a/examples/todo-app/main.w b/examples/todo-app/main.w index ca165bc..65168fb 100644 --- a/examples/todo-app/main.w +++ b/examples/todo-app/main.w @@ -76,7 +76,7 @@ class TaskStorage impl ITaskStorage { db: ex.Redis; counter: cloud.Counter; - init() { + new() { this.db = new ex.Redis(); this.counter = new cloud.Counter(); } @@ -139,7 +139,7 @@ class TaskService { extern "./tasklist_helper.js" static inflight createRegex(s: str): IRegExp; - init(storage: ITaskStorage) { + new(storage: ITaskStorage) { this.api = new cloud.Api(cors: true); this.taskStorage = storage; @@ -247,6 +247,6 @@ test "list tasks" { let response = http.get("${url}/tasks?search=task"); log("response: ${Json.stringify(response.body)}"); expect.equal(response.status, 200); - expect.equal(response.body, Json.stringify(Json[{"id":"0","description":"task 1","status":"PENDING"}])); + expect.equal(response.body, Json.stringify(Json[{"id":"0","description":"task 1","status":"PENDING"}])); expect.equal(response.headers.get("access-control-allow-origin"), "*"); }