import { Schema , Query , ObjectType , Field , schemaFactory } from "graphql-decorator" ; const graphql = require ( "graphql" ) . graphql ; @ ObjectType ( ) class QueryType { @ Field ( ) greeting ( ) { return "Hello, world!" ; } } @ Schema ( ) class SchemaType { @ Query ( ) query : QueryType ; } async function main ( ) { const schema = schemaFactory ( SchemaType ) ; const result = await graphql ( schema , `query { greeting } ` ) ; console . log ( result . data . greeting ) ; } main ( ) ;