Tag: Node.Js
-
Cors Problem with Node, typescript, GraphQl and Appllo
0 I’m getting corns with my application. Have I configured my server incorrectly ? I’m trying to create a user in my PostgreeSQL database via the frontend. I’ve made a tsx component which is a form. When I submit the data, it returns a cors error, my frontend being at localhost:3000 and my backend at…
-
cors problem with node, typescript, apollo and graphql
0 I’m getting corns with my application. Have I configured my server incorrectly ? I’m trying to create a user in my PostgreeSQL database via the frontend. I’ve made a tsx component which is a form. When I submit the data, it returns a cors error, my frontend being at localhost:3000 and my backend at…
-
I have graphql syntax error from BuildSchema
0 I use nodejs with typescript for my project and I decided to use graphql but I have a problem I tried many things but I am still in one place when I tried to debug the problem I found that this error occurs when I use "BuildSchema" from "graphql" package. so I give you…
-
How to make GraphQL efficient in terms of serverdatabase communication
0 I am relatively new to GraphQL. Although, I see the next issue in this api building approach. GraphQL allows efficient communication between client and server because the client could select the bare minimum required fields and server sends just these fields and nothing more. That reduces a client-server bandwidth. That’s a pros. Although, for…
-
What is [Symbol(kHeaders)] and how do I parse it as headers
2 I am having trouble parsing the header retrieved from graphql’s context, what I would like to do is to basically forward the headers from the request into the response My gateway: GraphQLModule.forRootAsync<ApolloGatewayDriverConfig>({ driver: ApolloGatewayDriver, inject: [ConfigService], useFactory: async(configService: ConfigService) => ({ server: { introspection: true, playground: true, cache: ‘bounded’ }, gateway: { buildService: (url)…
-
Resolve two GraphQL schema fields using one endpoint
2 There’s a situation where there are two possible types to fill data property. I have made a union type for that (ComponentItem) to determine which field needs to be returned. The first schema (ComponentItem1) should just be a hardcoded list but the second one (ComponentItem2) is more dynamic where it gets a searchTerm from…
-
I need to get context using websocket on appolo server
0 Before I could get the context using startStandaloneServer but now I have to use a websecket and I’m not getting the token how is the file server.Js import { ApolloServer } from ‘@apollo/server’; import { createServer } from ‘http’; import { expressMiddleware } from ‘@apollo/server/express4’; import express from ‘express’; import { ApolloServerPluginDrainHttpServer } from…
-
FetchError: invalid json response body GraphQL
0 I’m using @apollo/datasource-rest to wrap a 3rd party API. The endpoint I’m trying to hit checks if an email is already in use or not. If the email is in use the response looks like this "body": "True", "statusCode": 200, "contentType": "application/json", If the email is not in use the api returns a 404…
-
How to properly pass a user and run middleware on apollo server v4
1 I am creating an apollo server v4 gql gateway with the express.js integration. I have user typedefs and user resolvers working and creating a jwt when a user is created. I then try to use my jwtMiddleware middleware on the /graphql endpoint so that it can validate a bearer token is being passed in…
-
How to Process Uploaded Image with Graphql Apollo with SharpJS in NodeJS?
4 I have a graphql mutation that gets an image from the frontend, and that then is processed and optimized on my server. But I can’t figure out how to pass my image to sharp. Here is my code: const Mutation = { createImage: async (_, { data }) => { const { file }…