# @kult/graphql

Latest version **1.3.0** (published 2023-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @kult/graphql
pnpm add @kult/graphql
yarn add @kult/graphql
bun add @kult/graphql
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2023-04-01 |
| First published | 2023-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michael Kriel |
| Maintainers | michael616kriel |

## Links

- npm: https://www.npmjs.com/package/@kult/graphql
- Repository: https://github.com/michael616kriel/kult-graphql
- Issues: https://github.com/michael616kriel/kult-graphql/issues
- npm.io page: https://npm.io/package/@kult/graphql

## Dependencies (8)

- [koa](https://npm.io/package/koa.md) ^2.14.1
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [graphql](https://npm.io/package/graphql.md) ^16.6.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [apollo-server-koa](https://npm.io/package/apollo-server-koa.md) ^3.11.1
- [@graphql-tools/merge](https://npm.io/package/@graphql-tools/merge.md) ^8.3.17
- [@graphql-tools/schema](https://npm.io/package/@graphql-tools/schema.md) ^9.0.14

## Recent versions

- 1.3.0 (latest) — 2023-04-01
- 1.2.0 — 2023-02-02
- 1.1.0 — 2023-02-02
- 1.0.0 — 2023-02-02
- 0.0.7 — 2023-02-02
- 0.0.6 — 2023-01-27
- 0.0.5 — 2023-01-27
- 0.0.4 — 2023-01-27
- 0.0.3 — 2023-01-27
- 0.0.2 — 2023-01-27
- 0.0.1 — 2023-01-27

## README

# @kult/graphql
<div align="center">

[![Status](https://img.shields.io/badge/status-active-success.svg)]()
[![GitHub Issues](https://img.shields.io/github/issues/michael616kriel/kult-graphql.svg)](https://github.com/michael616kriel/kult-graphql/issues)
[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/michael616kriel/kult-graphql.svg)](https://github.com/michael616kriel/kult-graphql/pulls)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)

</div>

Graphql plugin for [@kult/core](https://michael616kriel.github.io/kult-core/)

Have a look at our [docs](https://michael616kriel.github.io/kult-docs/) for more information.

## Installation

yarn:

```bash label="bash"
yarn add @kult/graphql
```

NPM:

```bash label="bash"
npm i @kult/graphql
```

## Usage

Create a `schema.graphql` in your `src` directory:

```typescript label="./src/app/config/plugins.ts"
type Query {
  hello: String
}

type Mutation {
  sayHello: String
}
```

Register the plugin in `./src/app/config/plugins.ts`

```typescript label="./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:

```typescript label="./src/app/config/plugins.ts"
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

```bash label=".env"
GRAPHQL_PORT=3001
```
## Community

- [Discord](https://discord.gg/dRwGqHvE)

## Authors <a name = "authors"></a>

- [@michael616kriel](https://github.com/michael616kriel) - Idea & Initial work

See also the list of [contributors](https://github.com/michael616kriel/kult-graphql/contributors) who participated in this project.

---
_Source: https://npm.io/package/@kult/graphql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
