The create method will take user data from the view component, use fetch to make a POST call to create a new user in the backend, and finally return the response from the server to the component as a promise.
mern-skeleton/client/user/api-user.js:
const create = (user) => { return fetch('/api/users/', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify(user) }) .then((response) => { return response.json() }).catch((err) => console.log(err))}