Golang GraphQL Tutorial - Intro

EQuimper
13 Dec 201904:02

Summary

TLDRIn this tutorial, you'll learn how to build a GraphQL API using Go (Golang), with a focus on best practices and useful libraries. The video introduces the **GQL Gem** library for creating the GraphQL layer and **GoPG** for database interactions. Key concepts covered include schema-first development, using DataLoader to optimize database queries, and implementing user authentication and authorization. The tutorial aims to provide a practical introduction before diving into larger projects, with the end goal of building a meetup app where users can create and attend events. Perfect for those looking to learn GraphQL and Go together.

Takeaways

  • 😀 GraphQL with Golang tutorial focuses on using the gqlgen library for schema-first development.
  • 😀 gqlgen is preferred for its simple, efficient, and code-generation approach to working with GraphQL APIs.
  • 😀 The tutorial will walk through building the GraphQL layer, managing resolvers, and connecting to a PostgreSQL database.
  • 😀 go-pg is used for database interaction, providing solid performance and simplicity.
  • 😀 The tutorial introduces DataLoader to avoid the N+1 query problem in database handling.
  • 😀 DataLoader in Golang is simpler to implement compared to Node.js, thanks to the creator’s deeper understanding of the technology.
  • 😀 Authentication, authorization, and user actions (like deletion) will be covered.
  • 😀 The app being built is a simple meetup application, which users can interact with by creating meetups.
  • 😀 The tutorial avoids the common ‘To-Do app’ theme but still offers valuable learning opportunities for GraphQL and Golang.
  • 😀 Future tutorials may explore advanced GraphQL topics, including integration with frontend frameworks and clients.
  • 😀 The tutorial aims to teach both basic and advanced concepts, with the hope of providing a deeper understanding of backend development with GraphQL.

Q & A

  • What is the focus of the tutorial?

    -The tutorial focuses on building a GraphQL API using Golang, specifically using the `gqlgen` library for the GraphQL layer and `go-pg` for database interaction.

  • Why is the speaker using the `gqlgen` library for GraphQL?

    -The speaker prefers `gqlgen` because it is schema-first, meaning that developers define the GraphQL schema first and then the code is generated automatically, avoiding messy string maps or interfaces. Additionally, it has a solid community reputation and excellent documentation.

  • What does 'schema-first' design mean in the context of GraphQL?

    -'Schema-first' design means that developers define the API using GraphQL's Schema Definition Language (SDL) before writing any code. The GraphQL server code is then generated based on this schema, making it easier to manage and implement.

  • Which database tool is being used in the tutorial?

    -The tutorial uses `go-pg`, a PostgreSQL ORM for Go, which the speaker finds easy to integrate and performs well compared to other ORMs.

  • What is the purpose of using a data loader in this tutorial?

    -A data loader is used to prevent the N+1 query problem, which occurs when multiple database queries are executed unnecessarily. By batching and caching database queries, the data loader helps optimize performance.

  • How does the data loader help with performance optimization?

    -The data loader batches multiple database requests into a single query, reducing the number of database hits and addressing the N+1 query issue, leading to improved performance in the application.

  • What kind of application are we building in this tutorial?

    -The application being built is a meetup app, where users can create meetups. The speaker hints at potentially adding features like users attending meetups in the future.

  • What feature might be added to the meetup app in future lessons?

    -In future lessons, the speaker plans to add the functionality for users to attend meetups, expanding the app's capabilities.

  • What specific skills or concepts will the tutorial cover?

    -The tutorial will cover building the GraphQL layer, managing resolvers, handling database queries with `go-pg`, implementing data loaders to solve the N+1 query issue, and handling user authentication and authorization.

  • Why does the speaker mention the comparison to Node.js?

    -The speaker mentions Node.js to highlight the difference in implementing certain features. They feel that implementing a data loader in Go is simpler compared to Node.js, possibly due to their increased familiarity with Go.

Outlines

plate

Cette section est réservée aux utilisateurs payants. Améliorez votre compte pour accéder à cette section.

Améliorer maintenant

Mindmap

plate

Cette section est réservée aux utilisateurs payants. Améliorez votre compte pour accéder à cette section.

Améliorer maintenant

Keywords

plate

Cette section est réservée aux utilisateurs payants. Améliorez votre compte pour accéder à cette section.

Améliorer maintenant

Highlights

plate

Cette section est réservée aux utilisateurs payants. Améliorez votre compte pour accéder à cette section.

Améliorer maintenant

Transcripts

plate

Cette section est réservée aux utilisateurs payants. Améliorez votre compte pour accéder à cette section.

Améliorer maintenant
Rate This
★
★
★
★
★

5.0 / 5 (0 votes)

Étiquettes Connexes
GraphQLGo ProgrammingTutorialSchema FirstResolversData LoadersMeetup AppGo PGAuthorizationDatabase QueriesGraphQL Client
Besoin d'un résumé en anglais ?