ts2graphql
This tool converts your typescript interfaces to graphql schema.
// schema.ts
; ;
// index.ts
;; ;; // you should implement resolve methodsexpress.use '/api/graphql', graphqlHTTP; console.logprintSchemaschema;
will generate schema
type AudioBook { audioFile: String! """The authors of this content""" authors: [Author!]! name: String! publishedAt: Date! illustrator: Illustrator} type Author { id: ID! name: String! books(max: Int): [Book!]!} union Book = PDFBook | AudioBook scalar Date type Illustrator { __typename: String! name: String! email: String!} type PDFBook { file: String! """The authors of this content""" authors: [Author!]! name: String! publishedAt: Date! illustrator: Illustrator} type Query { getByAuthor(id: ID!): Author}