Giter Site home page Giter Site logo

Shoot a live demo about msw HOT 6 CLOSED

mswjs avatar mswjs commented on April 28, 2024 3
Shoot a live demo

from msw.

Comments (6)

hehehai avatar hehehai commented on April 28, 2024

@kettanaito What kind of program do you use for the demo if you want to record it? The react app or the vue app?

I tried to create a simple vue demo using codesandbox, but the service worker could not respond to the data. I think it was the domain name.

If it could be a demo like codesandbox, it would be a great start!

from msw.

kettanaito avatar kettanaito commented on April 28, 2024

@hehehai the problem with sandboxes is that you cannot execute npx (or any other commands) in its environment. One of the prerequisites for working with MSW is to copy its mockServiceWorker.js to your public directory. Even when manually copied into a sandbox, I have doubts what you see as "public" is actually the public directory of the served app. We can try, however, I haven't attempted to upload the Service Worker manually, it may work.

I think in terms of shooting a demo you can use the examples/create-react-app in this repository. I'd probably rework the UI to be more, em, presentable :) But having a sandbox with the example is a nice start, I totally agree. Do you mind trying uploading the mockServiceWorker.js manually to the public folder of a sandbox?

from msw.

hehehai avatar hehehai commented on April 28, 2024

@kettanaito codesandbox react msw example

Have you looked at this example?
I do not know why MSW does not capture and respond to information normally

from msw.

kettanaito avatar kettanaito commented on April 28, 2024

@hehehai, thanks for sharing. I've had a brief look into that and can see that Service Worker failed to register. There are also infinite errors regarding an invalid RegExp, which may be related to the usage of :username parameter in the path. I've removed the parameter and trying to mock an exact URL. Will update this thread with the result.

from msw.

kettanaito avatar kettanaito commented on April 28, 2024

I'm going to shoot a quick tutorial once the following pre-requisites are done:

from msw.

kettanaito avatar kettanaito commented on April 28, 2024

The pre-requisites for this task are done, and I'm preparing a setup and script for an introductory tutorial. I see no reason for this ticket anymore. Will update the README once the tutorial is public.

from msw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.