rest-vir - v1.2.6
    Preparing search index...

    Function fetchEndpoint

    • Send a request to an endpoint definition with type safe parameters.

      This can safely be used in frontend or backend code.

      Type Parameters

      • const EndpointToFetch extends
            | typeof NoParam
            | Readonly<
                {
                    methods: _RequireAtLeastOne<Record<HttpMethod, boolean>, HttpMethod>;
                    path: `/${string}`;
                    requestDataShape: Shape | undefined;
                    responseDataShape: Shape | undefined;
                    service: { serviceName: string; serviceOrigin: string };
                },
            >

      Parameters

      Returns Promise<FetchEndpointOutput<EndpointToFetch>>

      import {fetchEndpoint} from '@rest-vir/define-service';

      const {data, response} = await fetchEndpoint(myService.endpoints['/my-endpoint']);