Directory Structure
In the previous chapter, we have discussed that there 2 folders needed for Mock JSON response for a successful startup.
The directory structure of your project should be:
functions folder will store the JS files will have logical statements that would define routing and response of a request.
data folder will contain the json files will be mapped from the response object in the functions folder.
A Complete example:
functions/shoppingCart.js
cart.json
Above example, will send data present in cart.json when GET localhost:3000/mock/list is hit.
A detailed description of the field in request and response are given in upcoming chapters!
Last updated
Was this helpful?