Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 1.76 KB

File metadata and controls

43 lines (29 loc) · 1.76 KB

Project Setup

Before starting you must make sure you respect the prerequisites described in the project.

1. Create the project

We create our .NET 6 project:

# create the solution
dotnet new sln -n GraphQLIntro
# create the web project
dotnet new web -n graphqlServer
# add dependencies to the server project
dotnet add ./graphqlServer package HotChocolate.AspNetCore --version 12.1.0
dotnet add ./graphqlServer package MongoDB.Driver --version 2.12.1
dotnet add ./graphqlServer package HotChocolate.Data.MongoDb --version 12.1.0
# add web project to the solution
dotnet sln add graphqlServer

2. Prepare data

The data structure we will use is as follows:

The following structure is managed on 3 different collections:

  • Publisher: information on editor
  • Author: information on book authors
  • Book: information about the book

The data was generated via mockaroo.

To see the data populated, simply run the application:

dotnet run --project .\graphqlServer\

If you check your local db you will see the three populated collections.