Skip to content

Latest commit

 

History

History
23 lines (21 loc) · 437 Bytes

README.md

File metadata and controls

23 lines (21 loc) · 437 Bytes

Mock Data

dynamic url and dynamic mock data.
just need edit mock/mock.json file, then all requests starting with /mock will be forwarded to mock server.

Demo

// app.js
fetch('/mock/user').then(res=>res.json()).then(res=> {
    if (res) {
        setUser(res);
    }
});

// mock.json
{
    "GET /user": {
        "response": {
            "name": "lilonghe",
            "email": "lilonghe@gmail.com"
        }
    }
}