call method
Implementation
@override
Future<AwsApiGatewayResponse> call(Context context, AwsApiGatewayEvent event) async {
try {
final actions = <String, ControllerAction>{
'get': get,
'post': post,
'put': put,
'delete': delete,
};
final currentAction = actions[event.httpMethod?.toLowerCase()];
if (currentAction == null) throw 'invalid event';
final response = await currentAction.call(context, event);
return response;
} catch (ex, stack) {
print(ex);
print(stack);
// return AwsApiGatewayResponse.fromJson({}, statusCode: 500);
return AwsApiGatewayResponse.fromJson({
'exception': ex.toString(),
'stackTrace': stack.toString(),
}, statusCode: 500);
}
}