Skip to content

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.

Notifications You must be signed in to change notification settings

egocentryk/graphql-code-first-approach

Repository files navigation

Nest Logo

Project description

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.

Project setup

$ pnpm install

Docker

$ docker-compose up -d

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

GraphQL operation types

Queries

{
  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

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

subscription {
  coffeeAdded {
    id
    name
    brand
  }
}

Deployment

Check out Mau, 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 to learn more about the framework.
  • Deploy your application to AWS with the help of NestJS Mau in just a few clicks.
  • Visualize your application graph and interact with the NestJS application in real-time using NestJS Devtools.

License

Nest is MIT licensed.

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published