An open API service indexing awesome lists of open source software.

https://github.com/egocentryk/graphql-code-first-approach

Code-first approach to creating GraphQL APIs with Nest. It contains GraphQL concepts, tips & tricks, and patterns to create your own enterprise-grade GraphQL APIs.
https://github.com/egocentryk/graphql-code-first-approach

dataloader field-resolver graphql interfaces middleware resolvers scalar-types subscriptions typescript

Last synced: 10 months ago
JSON representation

Code-first approach to creating GraphQL APIs with Nest. It contains GraphQL concepts, tips & tricks, and patterns to create your own enterprise-grade GraphQL APIs.

Awesome Lists containing this project

README

          


Nest Logo

## Project description

Code-first approach to creating GraphQL APIs with [Nest](https://github.com/nestjs/nest). It contains GraphQL concepts, tips & tricks, and
patterns to create your own enterprise-grade GraphQL APIs.

## Project setup

```bash
$ pnpm install
```

## Docker

```bash
$ docker-compose up -d
```

-d flag stands for detached mode: run containers in the background

## GraphQL operation types

### Queries

```graphql
{
coffees {
id
name
brand
flavors {
id
name
}
createdAt
}
}

query ($coffeeId: ID!) {
coffee(id: $coffeeId) {
id
name
brand
flavors {
name
}
createdAt
}
}

{
drinks {
... on Tea {
name
}
... on Coffee {
name
brand
}
}
}
```

### Mutations

```graphql
mutation {
createCoffee(
createCoffeeInput: {
name: "Caramel Coffee"
brand: "Jacobs"
flavors: ["carameal", "sweat", "creamy"]
type: AMERICANO
}
) {
id
name
brand
flavors {
name
}
createdAt
}
}

mutation {
updateCoffee(
id: 1
updateCoffeeInput: { name: "Cappuccino", flavors: ["milky"] }
) {
name
flavors {
name
}
}
}

mutation {
removeCoffee(id: 1) {
name
}
}
```

### Subscription

```graphql
subscription {
coffeeAdded {
id
name
brand
}
}
```

## Deployment

Check out [Mau](https://mau.nestjs.com), Nest official platform for deploying NestJS applications on AWS.

## Resources

Check out a few resources that may come in handy when working with NestJS:

- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).

## License

Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).