@brightinteractive/bright-js-framework

@brightinteractive/bright-js-framework/plugins/graphql-server/http

interface BodyType

Object describing headers and serialization functions for the request body.

interface FetchUrl

Convenience interface for passing URL components to an http request.

interface RequestOpts
interface ResponseType

Object describing headers and deserialization functions for the response body. Built-in response types.

class HttpClient

HTTP client for use in GraphQL connectors.

A single HTTP client is shared between resolvers in a GraphQL requests. You can inject the HTTP client into a connector with the @inject decorator:

 class UserConnector extends Connector {
   @inject(HttpClient)
   httpClient: HttpClient

   async delete(id: string) {
     await this.httpClient.delete({
       baseUrl: process.env.USERS_API,
       subpath: `/users/${id}`
     })
   }
 }
class HttpError

Object describing the status code of a failed HTTP request.