0.0.33 • Published 6 years ago

aerographql v0.0.33

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Build Status Coverage Status npm version License: MIT

AeroGraphQL is a small and opinionated Typescript toolkit to create GraphQL server using a declarative approach.

Overview

Install AeroGraphQL

yarn add aerographql

Note that graphql is a needed peer dependency, you must install it beforehand

Define your schema

@ObjectDefinition( { name: 'User' } )
export class User {
    @Field( { type: 'ID' } ) id: string;
    @Field( ) name: String;
    @Field( { nullable: true }) description: String;
}

@ObjectImplementation( { name: 'RootQuery' } )
export class RootQuery {
    constructor( private userService: UserService ) { }

    @Resolver( { type: User } )
    user( @Arg() name: string ): User | Promise<User> {
        return this.userService.find( name );
    }
}

@Schema( {
    rootQuery: 'RootQuery',
    components: [ RootQuery, User ]
} )
export class MySchema extends BaseSchema {
}

Inject the schema within a GraphQL server

Apollo Server with Express in this case:

let mySchema = new MySchema();
this.app = express();
this.app.use( '/graphql', bodyParser.json(), graphqlExpress( { schema: mySchema.graphQLSchema } );
this.app.listen( config.get( 'server.port' ), () => {
    console.log( 'Up and running !' );
} );

Documentation

Checkout the AeroGraphQL documentation and explore basic examples.

License

AeroGraphQL is freely distributable under the terms of the MIT license.

0.0.33

6 years ago

0.0.32

6 years ago

0.0.31

6 years ago

0.0.30

6 years ago

0.0.29

6 years ago

0.0.28

6 years ago

0.0.27

6 years ago

0.0.26

6 years ago

0.0.25

6 years ago

0.0.24

6 years ago

0.0.23

6 years ago