UNPKG

graphql-yoga

Version:

[![GraphQL Conf 2023](/GraphQLConf-2023-Banner.png)](https://graphql.org/conf/)

17 lines (16 loc) 571 B
export function useHealthCheck({ id = Date.now().toString(), logger = console, endpoint = '/health', } = {}) { return { onRequest({ endResponse, fetchAPI, request }) { if (request.url.endsWith(endpoint)) { logger.debug('Responding Health Check'); const response = new fetchAPI.Response(null, { status: 200, headers: { 'x-yoga-id': id, }, }); endResponse(response); } }, }; }