/dotnet-demos

Contains a bunch of demos illustrating different functionalities of .NET

Primary LanguageC#

dotnet-graphql-demo

A demo project illustrating the basics of graphql with HotChocolate

References:

Follow the steps to run:

  • clone the repo
  • run dotnet watch run
  • go to the mock up url generated. Mine was at https://localhost:5001/graphql

Example queries:

query GetBookById{
  book(id: "asdasd2313") {
    title
    author {
      name
    }
  }
}

query GetBooks{
  allBooks{
    title
    author{
      name
    }
  }
}

Example mutations:

mutation AddAuthor {
  addAuthor(input: { name: "Hashem", age: 22, booksWritten: 10 }) {
    name
    age
  }
}

mutation AddBook {
  addBook(
    input: {
      author: { name: "Hashem", age: 40, booksWritten: 5 }
      title: "Sex and the City"
    }
  ) {
    author{
      age
      name
      booksWritten
    }
    title
  }
}