Giter Club home page Giter Club logo

Comments (9)

theodorDiaconu avatar theodorDiaconu commented on August 28, 2024 2

@lorensr yes, I know the error. Just add this:

  // We are doing this work-around because Playground sets headers and WebApp also sets headers
  // Resulting into a conflict and a server side exception of "Headers already sent"
  WebApp.connectHandlers.use('/graphql', (req, res) => {
    if (req.method === 'GET') {
      res.end();
    }
  });

from apollo.

theodorDiaconu avatar theodorDiaconu commented on August 28, 2024 1

@StorytellerCZ beautiful, I'm gonna roll-out the release and it will be fully BC. I've already managed to do it with beta, so that is crazy good news! It will be done next week.

from apollo.

mattblackdev avatar mattblackdev commented on August 28, 2024

I couldn't figure out how to connect WebApp with 2.0. I tried a few variations and gave up pretty quick since it's beta anyway. I think it has something to do with the built-in http server in 2.0.

from apollo.

theodorDiaconu avatar theodorDiaconu commented on August 28, 2024

@mattblackdev that would be bad, unless meteor would have a way to start without it's http server. But I'm sure they would still want to be able to apply themselves to express() or others.

I think there should be a way for this: https://www.apollographql.com/docs/apollo-server/v2/essentials/server.html#middleware

from apollo.

mattblackdev avatar mattblackdev commented on August 28, 2024

How would you obtain a reference to the express app?

registerServer({ server, app }); // app is from an existing express app

This is exactly what I tried but I don't think I figured out the right "app" reference. I filed an issue on apollo-server

from apollo.

mattblackdev avatar mattblackdev commented on August 28, 2024

Haven't tested yet myself, but apparently there is a newer version not yet referenced in the docs:

apollo-server-express@rc

From @evans' comment:

"[...] with apollo-server-express rc, you can import the ApolloServer class without the dependency on apollo-sever"

And to answer my own question about WebApp, use connectHandlers.

I'm guessing it goes something like:

import { ApolloServer } from 'apollo-server-express'
import { WebApp } from 'meteor/webapp'

const server = new ApolloServer()
server.applyMiddleware({
  app: WebApp.connectHandlers,
  server,
  path: '/graphql'
})

from apollo.

theodorDiaconu avatar theodorDiaconu commented on August 28, 2024

That is excellent. I'm waiting for the release but this looks promising, we're gonna remove a bunch of npm dependencies!

from apollo.

StorytellerCZ avatar StorytellerCZ commented on August 28, 2024

Looks like it is out: https://blog.apollographql.com/announcing-apollo-server-2-2b69fb4702ce

from apollo.

lorensr avatar lorensr commented on August 28, 2024

server.applyMiddleware({ app: WebApp.connectHandlers,

Were you able to get this working? I'm getting Error: Can't set headers after they are sent:

apollographql/meteor-integration#123 (comment)

from apollo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.