Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

egghead.io

Mock REST and GraphQL APIs with Mock Service Worker

via egghead.io

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Controlling the network is the key to fast prototyping, bullet-proof tests, and efficient debugging. Mocking the APIs you use gives you this kind of control but most methods in the client and server come up short. That's where Mock Service Worker does it right. With it you can intercept and take control of requests no matter where they're being made. In this course, you will learn how to: * setup and your first request handler * mock complex flows like authentication * describe dynamic requests * respond with HTTP streams, * and use schema-first GraphQL mocking After this course you'll be more than ready to bring MSW into your app and start mocking any kind of API you're using!

Syllabus

  • Introduction to Mock REST and GraphQL APIs with Mock Service Worker
  • Clone the GitHub Repository for Mock REST and GraphQL APIs with Mock Service Worker
  • Install Mock Service Worker (MSW) and Prepare Directory Structure
  • Set Up MSW in the Browser
  • Set Up MSW in Node.js
  • Intercept and Mock Server-Side HTTP Requests in MSW
  • Use the HttpResponse Class in MSW
  • Handle Dynamic Requests with Path Parameters in MSW
  • Add a Single Source of Truth for Fixtures in MSW
  • Intercept and Mock Client-Side HTTP Requests in MSW
  • Read Request Query Parameters in MSW
  • Mock Error Responses in MSW
  • Emulate Network Errors in MSW
  • Control Response Timing in MSW
  • Use MSW to Mock Authentication in Remix
  • Intercept and Mock GraphQL Queries in MSW
  • Intercept and Mock GraphQL Mutations in MSW
  • Mock GraphQL Errors in MSW
  • Resolve GraphQL Requests Against a Mock Schema in MSW
  • Mock All GraphQL Operations in MSW
  • Endpoint-Based GraphQL Mocking in MSW
  • Perform Intercepted Requests As-Is in MSW
  • Combine Original and Mocked Responses in MSW
  • Respond With a ReadableStream in MSW

Taught by

Artem Zakharchenko

Reviews

4.7 rating at egghead.io based on 25 ratings

Start your review of Mock REST and GraphQL APIs with Mock Service Worker

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.