Comments (6)
Just my opinion on the first question.
The resolver are there for the fields you need a customized answer or the field that doesn't exist on your entity.
For example, on your entity POST
you have field blogs(OneToMany with BLOG
) on your GraphQL type, you have one field called blogNames: [String]
. You want to use the resolver for blogName
, since it doesnt exist on your entity.
from vesper.
I understand the difference, I just feel that schema stiching would be done better via decorators and you can define all the logic in each entities respective resolver.
Leave controllers for REST APIs :)
from vesper.
Why do controllers and resolvers need to be defined in separate files? I feel like with Graphql, the resolver pattern is all that is needed, and I'm not sure why the distinction needs to be made.
distinction is made by graphql itself, and by conception itself. Root queries are unique, that's why controllers are separate for them. If you think about real difference in vesper, then what it will be? @Controller
over @Resolver
because resolver resolves some entity while controller is root-based. @Query
and @Mutation
- only controller can have a mutation, query is much more like a @Resolve
, but still terminology of root queries. Think about controllers as root queries.
I started my own Express setup before seeing Vesper, and I'm autoloading my entities, typeDefs and resolvers based on file naming conventions. Is this something that you'd be interested in doing with Vesper? (I know Typeorm already allows this for entities.)
please provide more info. "file naming conventions" - typeorm does not have file naming conventions, and it does not make sense to use file names.
How risky would you say it'd be to use Vesper at this stage of the project?
decide yourself, use it if you like it, like any project it just needs to get more people attention.
Have you looked into Prisma? It auto generates CRUD operations based on graphql models. Is this something you'd be interested in doing with Vesper?
prisma is much more opinionated and provides you certain limits, with vesper you have much more freedom and control on what you are doing.
from vesper.
distinction is made by graphql itself
Technically it's incorrect. Query
and Mutation
are just normal GraphQLObjectType
and getUser
query or editProject
mutation are just fields of that object type. The only difference is when we attach this "special" object types to schema, so multiple mutations are resolved sequentially while queries - parallel.
from vesper.
I didn't say that typeorm enforces conventions. What I mean is that you can load entities based on configured path, e.g. { entities: ['./src/**/entity{.ts,.js}'] }
.
And ah, to be clear, I've specifically been using Apollo Graphql, which generates a schema based on typedefs and resolvers: https://www.apollographql.com/docs/graphql-tools/generate-schema.html
Nest.js also works similarly https://docs.nestjs.com/graphql/resolvers-map
But anyway, I'll go ahead and close this, thanks
from vesper.
What I mean is that you can load entities based on configured path
you can load controllers, resolvers and schemas based on paths as well.
from vesper.
Related Issues (20)
- CRITICAL: TypeError: Cannot read property 'type' of undefined HOT 5
- There is any plan to support Koa?
- Multi connexion DB
- Implementing Relay-compatible connections
- Resolver doesn't work with subscription HOT 1
- Authentication in subscription
- Ability to customize topic/trigger sbscribed to at subscription initialization time? HOT 1
- Select only limited query params HOT 1
- Need a way to set typeorm connection charset HOT 3
- Batch resolve method should be invoked N times for N aliases with different arguments.
- EntityManager doesn't work with existing TypeORM project HOT 2
- Any Example for Basic Authentication
- Project outdated? HOT 11
- Uploade image HOT 2
- Custom errors format
- Is this dead? HOT 3
- Add custom playground url
- Apollo context
- Vesper Build failure HOT 2
- Your website is broken (blank screen)
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 vesper.