Code Monkey home page Code Monkey logo

Comments (5)

kbrandwijk avatar kbrandwijk commented on August 27, 2024 1

I agree both syntax options should work. This should and can be fixed in start(), checking if the first parameter is a function.

from graphql-yoga.

lunchboxer avatar lunchboxer commented on August 27, 2024

I believe this is related to recent pull request 77 it looks like the callback isn't the first argument anymore. Shouldn't it be? since options are optional, shouldn't they go after?

from graphql-yoga.

lunchboxer avatar lunchboxer commented on August 27, 2024

Indeed changing the function call to:
server.start(null, () => console.log("Server is running on http://localhost:4000"));
fixes the problem and the callback gets executed. One could either change all the boilerplates and the docs to reflect this api change, or one could put the callback as the first argument. I'm in favor callbacks first.

from graphql-yoga.

lunchboxer avatar lunchboxer commented on August 27, 2024

I suppose that a good implementation with no options and a callback keeping with js conventions, would be:

const options = {}
server.start(options, () => console.log("Server is running on http://localhost:4000"))

I'd be cool with that, but then you gotta merge my pull requests for updating all of the examples and docs.

from graphql-yoga.

schickling avatar schickling commented on August 27, 2024

Both syntax options should be supported. This rather looks like a bug to me. @kbrandwijk what are your thoughts?

from graphql-yoga.

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.