handler method

  1. @override
Future<Response> handler()
override

Must be implemented

Implementation

@override
Future<Response> handler() async => checkApiSecret(request).fold(
      (response) => response,
      (request) async {
        final statuses = await Future.wait(
          [
            _checkGraphQL(),
            _checkGeoApi(),
            _checkUmbrella(),
            _checkFirebaseAuthFunctions(),
          ],
        );

        final anyError = statuses.any((status) => !status.isReady);
        final body = statuses.map((status) => status.toJson()).toList();

        return anyError
            ? Response(
                503,
                body: jsonEncode({
                  'status': 'not ready',
                  'services': body,
                }),
              )
            : Response.ok(
                jsonEncode({'status': 'ok', 'services': body}),
              );
      },
    );