Building a .NET GraphQL Server

Albert Starreveld
6 min readNov 10, 2022

GraphQL is a query language developed by Facebook in 2012 (publicly released in 2015). In a GraphQL query, the consumer of an API specifies the structure of the data it needs. The server executes the query, collects the data from one or various data sources, filters out the fields which aren’t specified in the query, and returns the result as JSON objects.

What problem does GraphQL solve?

Imagine this Rest API. It has two endpoints:

[GET] /roomreturns: [
{
roomId: 1,
locationId: 1,
name: 'Ideation Zone',
capacity: 30
},
{
roomId: 2,
locationId: 1,
name: 'Creative Arena',
capacity: 60
}
]

And

[GET] /presentationreturns[
{
presentationId: 1,
presentorIds: [5, 24],
roomId: 1,
start: '2022-10-02T13:00:00Z',
end: '2022-10-02T15:00:00Z',
title: 'GraphQL for newbies',
description: 'Lorum ipsum...'
},
{
presentationId: 2,
presentorIds: [6],
roomId: 2,
start: '2022-10-02T14:00:00Z',
end: '2022-10-02T15:00:00Z',
title: 'Advanced Rest',
description: 'Dolar sit amet..'
}
]

Usually, the product owner asks the team to build the following table:

| Presentation        | Starts at        | Room           |
+---------------------+------------------+----------------+
|…

--

--

Albert Starreveld
Albert Starreveld

Written by Albert Starreveld

Passionate about cloud native software development. Only by sharing knowledge and code can we take software development to the next level!

No responses yet