Closed annibuliful closed 4 years ago
Thank you sir
I had to change schemaGraph
to schema: schemaGraph
though (I forgot to change it in my first reply), hope you figured it out! :smile:
Thank you sir
Apologies for not seeing this sooner! Thank you @Extarys for your example, I might document this in the README.
No problem, my pleasure
it doesn't work . I don't know what are the problems
I fix it by changing httpServer
to fastify.server
it's not error but Subscription doesn't work. Why?
I'm not sure that [object object]
is error or not ?
https://github.com/n3ologism/music-fastify/tree/backend/backend/src
This is my repository
@lagmanzaza tnx, its work for me fastify.server
import { execute, subscribe } from 'graphql'
import { SubscriptionServer } from 'subscriptions-transport-ws';
import { schema } from "./api/schema"
const fastify = require('fastify')({
logger: false
})
// This `listen` method launches a web-server
fastify.listen(3000, (err, address) => {
if (err) throw err
console.log('\x1b[35m', `🚀 Server ready at http://localhost:3000/graphql`)
console.log("\x1b[35m", `🚀 Subscription server ws://localhost:3000/graphql`)
})
new SubscriptionServer(
{
schema,
execute,
subscribe,
},
{
server: fastify.server,
path: '/graphql',
},
);
@nikitamarcius Actually, You can use Apollo server instead
@lagmanzaza nope. Tried first, HTTP endpont works, but subscriptions no handshake error
. Test with Koa and Fastify. Works only with HTTP native module
Better Graphql + Fastify + subscriptions.
I have some schema issues, but that'S the code I have right now. Hope it works.