Skip to content
This repository was archived by the owner on Oct 13, 2020. It is now read-only.

Commit 4ef6594

Browse files
authored
Update README.md
1 parent 30b7a8d commit 4ef6594

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class PostUserHandler extends AbstractRequestHandler {
3737
this.cors('*');
3838
}
3939

40-
execute(body, context) {
41-
return { message: 'Hello from aws-wave' };
40+
execute(body, context, callback) {
41+
callback({ message: 'Hello from aws-wave' });
4242
}
4343
}
4444

@@ -86,8 +86,8 @@ class PhoneConfirmationHandler extends AbstractRequestHandler {
8686
this.cors('*');
8787
}
8888

89-
execute(body, context) {
90-
return { message: 'The request body is valid!' };
89+
execute(body, context, callback) {
90+
callback({ message: 'The request body is valid!' });
9191
}
9292
}
9393

@@ -160,8 +160,8 @@ class MyHandler extends AbstractRequestHandler {
160160
this.cors('*');
161161
}
162162

163-
execute(body, context) {
164-
return { message: 'The request body is valid!' };
163+
execute(body, context, callback) {
164+
callback({ message: 'The request body is valid!' });
165165
}
166166

167167
resolveRequestBodyValidator() {
@@ -240,12 +240,12 @@ class PostUserHandler extends AbstractRequestHandler {
240240
this.cors('*');
241241
}
242242

243-
execute(body, context) {
243+
execute(body, context, callback) {
244244
// any validation
245245
if (body.hasPermission)
246-
throw new UnauthorizedException({'The user has no permission'});
246+
return callback(new UnauthorizedException({'The user has no permission'}));
247247

248-
return { message: 'The user has permission'};
248+
callback({ message: 'The user has permission'});
249249
}
250250
}
251251

0 commit comments

Comments
 (0)