# gqlhttptools

> A GraphQL tool to work with schemas and express-graphql

Latest version **1.0.0** (published 2020-11-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install gqlhttptools
pnpm add gqlhttptools
yarn add gqlhttptools
bun add gqlhttptools
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-11-17 |
| First published | 2020-11-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Martin Fernandez |
| Maintainers | maramal |
| Keywords | GraphQL, GraphQLHTTP, Schema, gql, Express |

## Links

- npm: https://www.npmjs.com/package/gqlhttptools
- Repository: https://github.com/maramal/gqlhttptools
- Homepage: https://github.com/maramal/gqlhttptools#readme
- Issues: https://github.com/maramal/gqlhttptools/issues
- npm.io page: https://npm.io/package/gqlhttptools

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-11-17

## README

# GQLHTTPTools

GQLHTTPTools is a very basic tool to modularize GraphQL type definitions and attach them to [express-graphql](https://github.com/graphql/express-graphql) `graphqlHTTP()` `typeDef` property without worrying about separating schemas or nesting them on a messy big string.

## Installation

You can use npm or yarn, like you always do:

### NPM

`npm install gqlhttptools`

### Yarn

`yarn add gqlhttptools`

## How to use

The very first thing after installation is to import `buildSchema()` into your schema file:

```typescript
import { buildSchema } from 'gqlhttptools';
```

Then you can build your schema:

```typescript
const usersSchema = buildSchema(`
    type Query {
        users: [User]
        user(id: String!): User
    }

    type User {
        id: ID
        name: String
        username: String
        password: String
    }
`);
```

After this, you can now import `createSchema()`:

```typescript
import { createSchema } from 'gqlhttptools';
```

Then, when you have all your schemas defined you can attach them to `graphqlHTTP()` properties:

```typescript
graphqlHTTP({
    typeDef: createSchema(usersSchema),
    // ... 
})
```

Or you can pass an array:

```typescript
graphqlHTTP({
    typeDef: createSchema([usersSchema, categoriesSchema, anotherSchema]),
    // ... 
})
```

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