logo

NJP

GraphQL Create an API Resolver Mapping - Learn Integrations on the Now Platform

Import · Dec 04, 2023 · video

[Music] in this video we'll discuss the graphql resolver mappings as part of our custom graphql API in the now platform resolver mappings Define how the resolvers are mapped to the various fields and functions in the schema they're found in the graphql API record under the related list labeled graphql resolver mappings let's take a look at this example our schema has a query function called get game as we see here we'll use the path field to identify what part of the schema we want to map and the resolver to tell it what script to run when that function is called here's the neat thing about resolvers they can be used more than once in a mapping let's say we have a schema that has a function called get user we then create a resolver to get a user and map that query col in get user to the get user user resolver now as you might expect the user may have a reference field to manager which in it itself is another user we can create another mapping to connect the same get user resolver to the manager field in the user type we'll see an example of this in the video on complex data types resolver mappings are one of the most common things to forget when creating a custom graphql API so make a mental note put a sticky note on your monitor or or some other reminder so you don't forget which many of us have done until it becomes second nature now let's move on to the next video where we'll build a new API from scratch including the schema the resolvers and resolver mappings and then we'll run some test queries on it

View original source

https://www.youtube.com/watch?v=MWEl4Ndwq80