Download WYSIWYG ®
Gender:
Longevity: 10 years
Posts: 1546
Fullstack GraphQL
Год издания : 2020Автор : Derks Roy, Checinski GaetanoИздательство : newlineЯзык : АнглийскийФормат : PDF/epubКачество : Издательский макет или текст (eBook)Интерактивное оглавление : ДаКоличество страниц : 231Описание : Build Robust, Safe, and Flexible APIs with GraphQL GraphQL changed the way data is transferred between applications. As you will work through this book, we hope you won’t just add GraphQL to your toolbox, but also develop a new way of thinking about data models, APIs, and full-stack development. GraphQL – and it’s huge ecosystem – give you tools to create and consume flexible, easy-to-use, type-safe APIs. Usage Driven: It encourages users to define queries that specify what data to fetch in a granular way. Intuitive: GraphQL delivers you only the data that you request, in the exact format that you requested Self-descriptive: GraphQL schemas are strongly typed and define a strict contract between a query and its response. GraphQL embodies many lessons learned from API design that enforces several best practices into one solution, and in Fullstack GraphQL we show you how to use these tools with practical code-driven examples. What’s in the book Fullstack GraphQL is the busy engineer’s guide to building real-world GraphQL servers and clients with examples in Node.js, React, TypeScript, and Apollo. How to write GraphQL Schemas How to write flexible APIs with GraphQL and Node.js How to generate TypeScript types from your GraphQL types – for type-safe code that matches your API How to use an ORM to automatically generate your GraphQL API How to setup authentication and authorization for your API How to use Apollo Client with Hooks in your React app How to use GraphQL developer tools How to optimize your GraphQL server fetching with DataLoader How to paginate queries and write efficient pagination resolvers How to modify data with Mutations
Оглавление Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 What is GraphQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Why GraphQL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Usage driven and Intuitive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Self-descriptive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Other advantages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Join Our Discord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Hello GraphQL - GraphiQL and Github’s GraphQL Playground . . . . . . . 11 Enter GraphiQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Our First Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Named Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Multiple Queries and Renaming Result fields . . . . . . . . . . . . . . . . . . 24 Fragments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Union Types and Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Pagination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Mutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 GraphQL queries over HTTP - fetching with fetch and curl . . . . . . . . 37 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Hello GraphQL from Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 A GraphQL Hello World from Node . . . . . . . . . . . . . . . . . . . . . . . 39 Making Changes with Mutations . . . . . . . . . . . . . . . . . . . . . . . . . 41 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Hello GraphQL in the Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 A GraphQL Hello World from Localhost . . . . . . . . . . . . . . . . . . . . 43 Putting the Query in the App . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Creating a Custom Hook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Making Updates with Mutations . . . . . . . . . . . . . . . . . . . . . . . . . 49 Handling User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Picking a GraphQL Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 GraphQL is just JSON over HTTP (well, usually) . . . . . . . . . . . . . . . 54 Why You Might Want a Dedicated GraphQL Client . . . . . . . . . . . . . . 55 So What Are The Options? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 graphql-request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 urql . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Relay Modern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Apollo Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 What to Choose? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 The Basics of Apollo Client and React . . . . . . . . . . . . . . . . . . . . . . . . 62 Apollo Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Getting Hooked on useQuery . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Getting hooked on useMutation . . . . . . . . . . . . . . . . . . . . . . . . . . 66 How to use Apollo Client across your app . . . . . . . . . . . . . . . . . . . . 67 ApolloClient and Testing Components . . . . . . . . . . . . . . . . . . . . . . 67 Remember . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Building a TypeSafe GraphQL React Client App - Part 1 . . . . . . . . . . . . 72 What are we building? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Tooling and Project Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 TypeScript and GraphQL Types - There is a difference . . . . . . . . . . . . 75 Generating Types with graphql-codegen . . . . . . . . . . . . . . . . . . . . . 76 Generating Types for Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Generating Helper Functions for Apollo . . . . . . . . . . . . . . . . . . . . . 79 Building the Issue Finder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Creating the Search Component . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Visualizing Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Pagination with cursors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Tracking our cursorState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Building a TypeSafe GraphQL React Client App - Part 2 . . . . . . . . . . . . 93 What are we building? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Loading Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Mutations - Modifying Existing Data . . . . . . . . . . . . . . . . . . . . . . . 103 Mutations - Creating New Data . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Refetching Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Manually Updating the Apollo Cache . . . . . . . . . . . . . . . . . . . . . . 110 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Your First GraphQL Server with Apollo Server . . . . . . . . . . . . . . . . . . 115 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 The Obligatory Boilerplate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Mocking the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Resolvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Chaining Resolvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Passing Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Using GraphQL Servers with A Database . . . . . . . . . . . . . . . . . . . . . 137 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Using GraphQL with a Database . . . . . . . . . . . . . . . . . . . . . . . . . 138 Queries with pagination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Writing Mutation Resolvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Caching and Batching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Optimized queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Batching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Cost computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Authentication and Authorization in GraphQL . . . . . . . . . . . . . . . . . . 178 JWT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Resolver Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Context Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 Schema Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Code First GraphQL with TypeORM and TypeGraphQL . . . . . . . . . . . . 205 TypeGraphQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Implementing Pagination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 Using Context in a Resolver . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 TypeORM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Authorization with TypeGraphQL . . . . . . . . . . . . . . . . . . . . . . . . 221 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 More on TypeGraphQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Where to Go From Here? Advanced GraphQL . . . . . . . . . . . . . . . . . . 224 What did you think? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Awesome GraphQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Say Hello . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
[only-soft.org].t137924.torrent
Torrent:
Registered [ 2021-04-12 18:00 ]
· 6EFC2E5A2BF3ED59FECD670C04935359F03D0C8D
35 KB
Status:
√ checked
Completed:
2 times
Size:
23 MB
Rate:
(Vote: 0 )
Have thanked:
0
Derks Roy, Checinski Gaetano - Fullstack GraphQL [2020, PDF/EPUB, ENG] + code download torrent for free and without registration