1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Create your first AWS AppSync GraphQL API

    nader dabitnader dabit
    awsAWS
    graphqlGraphQL
    ^14.0.0

    In this lesson, we’ll use the AWS AppSync console to create a new AWS AppSync API. We’ll then implement our first GraphQL Schema & data source in the new API.

    We'll see that when using GraphQL with AWS AppSync, many of our Queries, Mutations, and Subscriptions are autogenerated for us.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Discuss

    Discuss

    Transcript

    Transcript

    Instructor: To create a new API, click on the orange create API button in the AWS app sync dashboard. Next, we'll be given the options either create an API from scratch or use a preconfigured example application. We'll choose author from scratch, because we'd like to start with the brand new blank schema.

    Next, we'll give the API name and click the orange create button. Once the API is being created, we'll be given some information about the API including the API URL, the API ID, and the API key. In a left hand menu, click on schema, so we can go ahead and create our GraphQL schema.

    In the schema view, we can either create or schema from scratch, or we can use the create resources flow, which will automatically generate our schema, our resolvers, as well as our data sources based on a single type.

    For this example, let's go ahead and click on the create resources button. Here, we can either define a new type or use an existing type that's been defined in our schema. For our example, we'll go ahead and create a new type of Todo.

    The Todo type will have an ID of ID, a title of string, and a completed of Boolean. If we scroll down, we'll see that some additional schema is going to be created for us. We can see that will have three mutations, three subscriptions, and two queries that are automatically created for us.

    Next, go ahead and scroll to the bottom of the page and click create. Once the resource creation is complete, we'll see that the automatically generated schema has been added to our schema view. Next, let's go ahead and click on data sources in the left hand menu to view the data source that was created for us.

    Here, we see that a DynamoDB table or Todo table has been created. To view the table, we can click on the resource name. Here, we can view the table information as well as any items that have been added to the table.