Updating our Schema

Learn how to update a schema by using Postgres with an endpoint.

User type and input

We’ll use a schema with only the User type. Let’s start by adding this type and then creating our resolvers. We’ll add the definition of the following types:

Press + to interact
const types = gql`
type User {
id: String
firstname: String
lastname: String
}
input UserInput {
firstname: String
lastname: String
}
`;

User queries

In this section, we’ll define our queries. In particular, we’ll define the getUser query that returns a given user from their associated id. As the first step, let’s add the query to our types:

...