Question: schema.js => schema.graphql?
See original GitHub issueMy current setup has my schema in a .js file, like this:
const typeDefs = `
type InstantMessages {
id: Int
from_id: String
to_id: String
msgText: String
}
[.....]
schema {
query: Query,
mutation: Mutation
subscription: Subscription
}
`;
export default typeDefs;
Then in order to use the schema with Apollo via swydo-ddp-apollo
, I do this:
import AllResolvers from "./api/resolvers";
import AllSchema from "./api/schema";
//APOLLO
import {setup} from 'meteor/swydo:ddp-apollo';
const typeDefs = [AllSchema];
const resolvers = [AllResolvers];
const schema = makeExecutableSchema({
typeDefs,
resolvers
});
setup({
schema
});
If I rename schema.js => schema.graphql, I can’t export the schema.
What is the correct way to solve this?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
GraphQL schema basics - Apollo GraphQL Docs
Your GraphQL server uses a schema to describe the shape of your available data. This schema defines a hierarchy of types with fields...
Read more >Schemas and Types - GraphQL
Every GraphQL service defines a set of types which completely describe the set of possible data you can query on that service. Then,...
Read more >How to Retrieve a GraphQL Schema | by Mr. Thank You
A GraphQL schema is a document describing how a specific GraphQL server is structured. A GraphQL schema is like a SQL database design....
Read more >GraphQL Schemas, TypeDefs & Resolvers - Prisma
Before starting to build your server, GraphQL requires you to design a schema which in turn defines the API of your server. In...
Read more >Executable Schemas – GraphQL Tools
The GraphQL-Tools package allows you to create a GraphQL.js GraphQLSchema instance from GraphQL schema language using the function ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vepanimas Awesome. This is working. Thanks very much!
@VikR0001 ok, I’m not familiar with meteor myself, but it looks like you should use this package. There is an example of exactly what you want to implement for a schema loading. After that, you will be able to import from any graphql file in your js files. Then you should move your schema from
.js
file toschema.graphql
. And the last step is creating.graphqlconfig
at the root of a project.More details about creating a config could be found here.