Giter VIP home page Giter VIP logo

Comments (4)

kikoseijo avatar kikoseijo commented on July 19, 2024 2

Just another tip, on the React side with Relay Modern, im using commands like:

yarn db, this will download the schema from the given endpoint and after will do the local compilation using the generated schema.graphql.

// pacakage.json

"scripts": {
  "db": "yarn schema && yarn relay",
  "schema": "graphql get-schema -i -e dev",
  "relay": "relay-compiler --src ./src --schema ./schema.graphql",
}

// .graphqlconfig

{
  "schemaPath": "schema.graphql",
  "extensions": {
    "endpoints": {
      "dev": {
        "url": "http://appgestor.test/v1/graphql",
        "method": "post"
      },
      "dev-auth": {
        "url": "http://appgestor.test/api/graphql",
        "method": "post"
      },
      "prod": {
        "url": "https://XXX/v1/graphql",
        "method": "post"
      },
      "prod-auth": {
        "url": "https://XXX/api/graphql",
        "method": "post"
      }
    }
  }
}

from lighthouse.

kikoseijo avatar kikoseijo commented on July 19, 2024 1

The power of a single schema its awesome,
I think you mixing a query with a relationships,
What about the example project?
https://github.com/nuwave/lighthouse-example

from lighthouse.

kikoseijo avatar kikoseijo commented on July 19, 2024 1

Im also working on Relay Modern and all you need now its the introspection.

You can download GrahqQL Playground, just open the url of the endpoint and you will be able to see all queries, mutations, etc.

screen shot 2018-05-12 at 10 21 05

All you need to concentrate its on your .schema , you probably looking to do something like this:

type Car {
  make: String!
  year: Int!
  # Set type pagination type to `cursor` and since the field doesn't match the name of the
  # relationship, you can customize it with the `relation` argument
  extras: [CarOption!]! @hasMany(type: "relay" relation: "options")
}

Use this trait for your models:

...
use Nuwave\Lighthouse\Support\Traits\IsRelayConnection;

class Car extends Model
{
    use IsRelayConnection;
    ...

and declare your types on the .graphql files with something like (see @model and @globalID)

type Media @model {
  id: ID! @globalId
  thumb: String
  list: String
  featured: String
  large: String
  xlarge: String
}

from lighthouse.

alexwhb avatar alexwhb commented on July 19, 2024

@kikoseijo Thank you so much for your detailed explanation. This is soooo helpful and exactly what I was looking for. 👍

from lighthouse.

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.