<@U02UDUD1HKL> I've found that apollo-datasource-...
# prisma-client
a
@Alonso A. I've found that apollo-datasource-rest, apollo-datasource-http, or axios works well for handling data-sources with apollo server. you can make blazing fast 3rd party integrations using axios/apollo-datasource-rest. I use both currently and have zendesk calls to their rest endpoint integrated as queries/mutations
Copy code
// see <https://www.apollographql.com/docs/tutorial/data-source/>
import { RequestOptions, RESTDataSource, Request, Response } from "apollo-datasource-rest";
//...
export class ZenApi extends RESTDataSource<Request> {
  constructor() {
    super();     
  }
  baseURL = `https://${
      process.env.ZEN_SUBDOMAIN || ""
      }.<http://zendesk.com/api/v2/`;|zendesk.com/api/v2/`;> 
// do stuff -- get post etc
  async zenPostUserCreateTicket(ticketInput: ZenUserCreateTicketInput) {
    return await <http://this.post|this.post><ZenSyncUserTicketOutput>('tickets', { ticketInput }).then((ticket) => ticket)
  }
}

// IN THE SERVER FILE
	const server = new ApolloServer({
		schema,
        typeDefs,
		apollo as ApolloConfigInput,
		playground: isProdEnvironment() === false,
		dataSources: (): DataSources<object> => {
			return {
				zenApi: new ZenApi()
			}
		},
		async context({ req, res }): Promise<Context> { /*return prisma in context*/}
but first try returning prisma as typeof PrismaClient in your server's context so you can access it in GraphQLContext as well as in RequestContext
a
I only have a very simple server right now and i am able to console log the response but can't seem to work for sending it to the client side not sure why since the fetching and data is there.