Fetch

In the frontend, to fetch the games for a specific user with this list by the maker API, we will add a fetch method in api-game.js.

mern-vrgame/client/game/api-game.js:

const listByMaker = (params) => {  return fetch('/api/games/by/'+params.userId, {    method: 'GET',    headers: {      'Accept': 'application/json'    }  }).then((response) => {    return response.json()   }).catch((err) => {    console.log(err)   }) }

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.