@kult/graphql
v1.3.0
Published
<div align="center">
Downloads
14
Readme
@kult/graphql
Graphql plugin for @kult/core
Have a look at our docs for more information.
Installation
yarn:
yarn add @kult/graphql
NPM:
npm i @kult/graphql
Usage
Create a schema.graphql
in your src
directory:
type Query {
hello: String
}
type Mutation {
sayHello: String
}
Register the plugin in ./src/app/config/plugins.ts
import KultGraphqlPlugin from '@kult/graphql';
export default {
plugins: [KultGraphqlPlugin],
};
Define your queries and mutations using the @Query
and @Mutation
decorators:
import { Application, ControllerBase, Controller } from '@kult/core';
import { Mutation, Query } from '@kult/graphql';
@Controller('/users')
class UserController extends ControllerBase {
constructor(app: Application) {
super(app);
}
@Query()
hello() {
return 'hello world';
}
@Mutation()
sayHello() {
return 'hello world';
}
}
export default UserController;
Environment Variables
Ensure this port is different than your server's port
GRAPHQL_PORT=3001
Community
Authors
- @michael616kriel - Idea & Initial work
See also the list of contributors who participated in this project.