Skip to content

dalvarado86/msw-graphql-example

Repository files navigation

MSW GraphQL Example

This repository provides an example of using Mock Service Worker (MSW) with GraphQL. MSW is a powerful tool for mocking API requests in both development and testing environments.

Getting Started

Prerequisites

  • Node.js (>= 12.x)

Installation

  1. Clone the repository:

    git clone https://github.com/dalvarado86/msw-graphql-example.git
    cd msw-graphql-example
  2. Install dependencies:

    npm install

Note: Latest version of MSW is having issues with Next.JS, please use the 2.0.14 in the meaintime MSW is fixed.

Running the Example

To start the development server:

npm run dev

Usage

This example demonstrates how to set up MSW to intercept GraphQL requests and provide mock responses. You can customize the mocks in the src/mocks/handlers.js file.

Acknowledgements

About

A basic example using MSW + GraphQL in a Next.JS app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published