Comments (4)
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.
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.
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.
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.
@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)
- Programmatically defined types cannot be found or overwrited while parsing .graphql file HOT 3
- @guard directive in fields but I always get "Unauthenticated" error. HOT 1
- Multiple queries / mutations in single request stop at first error HOT 3
- I faced issue lighthouse middleware HOT 1
- work with Multiple database connection HOT 1
- NOT_LIKE operator not working HOT 1
- ебаные пидорасы
- Directives for root types HOT 3
- Schema cache leaks memory with Laravel Octane HOT 1
- I have problems with many-to-many connections
- GraphQL integration in Laravel Repository Pattern
- Can not solve multiple file upload
- [FEDERATION] error SATISFIABILITY_ERROR when check the schema HOT 2
- `@in` directive breaks if client sends null HOT 1
- "No query results for model [App\\Models\\Permission]." using @create mutation HOT 4
- When using throttle directive how can the client be informed when they can retry again etc. HOT 3
- `@can` directive improvements HOT 1
- Only allow deletion of related models in nested mutations
- `@can` with `injectArgs: true` doesn't inject args passed as variables HOT 3
- laravel lighthouse graphql getting error Content-Type multipart/form-data HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lighthouse.