@forinda/kickjs-graphql
v1.6.0
Published
GraphQL module for KickJS with decorator-based resolvers, schema generation, and playground
Maintainers
Keywords
Readme
@forinda/kickjs-graphql
GraphQL module for KickJS with decorator-based resolvers, schema generation, and playground.
Install
# Using the KickJS CLI (recommended — auto-installs peer dependencies)
kick add graphql
# Manual install
pnpm add @forinda/kickjs-graphql graphqlFeatures
GraphQLAdapter— lifecycle adapter with GraphiQL playground- Decorator-driven resolvers:
@Resolver,@Query,@Mutation,@Subscription,@Arg - Automatic schema generation from decorated classes
- DI-integrated resolvers
Quick Example
import { GraphQLAdapter, Resolver, Query, Mutation, Arg } from '@forinda/kickjs-graphql'
@Resolver()
class UserResolver {
@Query('users', '[User]')
async list() {
return [{ id: '1', name: 'Alice' }]
}
@Mutation('createUser', 'User')
async create(@Arg('name') name: string, @Arg('email') email: string) {
return { id: '2', name, email }
}
}
bootstrap({
modules,
adapters: [
new GraphQLAdapter({
resolvers: [UserResolver],
playground: true,
}),
],
})Visit http://localhost:3000/graphql for the GraphiQL playground.
Documentation
License
MIT
