I am using express-graphql
and I am trying to implement interfaces, like here and here. However, I do not know how to implement those, since the notation people use is totally different from what I am used to in nodejs.
In the second answer, for example, somebody wrote this:
type Query {
blocks: [ ContentBlock! ]!
}
type Video implements ContentBlock {
id: ID!
url: String!
}
type Quote implements ContentBlock {
id: ID!
body: String!
author: String
}
type Advertisement implements ContentBlock {
id: ID!
src: String!
backgroundColor: String
}
interface ContentBlock {
id: ID!
}
My own definitions in express-graphql
look more like this however:
const Quote = new GraphQLObjectType({
name: "Quote",
fields: () => ({
id: { type: GraphQLID },
body: { type: GraphQLString },
author: { type: GraphQLString },
}),
});
Could somebody help me out here? I am also wondering where to find this information in general. I looked at the documentation of express-graphql on github but I couldn't find anything explaining how to do interfaces or unions.