npm install json-server
"scripts": { "server": "json-server data/names.json --port 9500" }// GET
useEffect(() => {
async function fetchObjects() {
const res = await fetch(`http://localhost:9500/objects`);
}
}, []);// POST
async function createObjects(newObject) {
const res = await fetch(`http://localhost:9500/objects`, {
method: "POST",
body: JSON.stringify(newObject),
"Content-Type": "application/json",
});
const data = res.json();
}