SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON

const ProfileEditPage = () => {
useEffect(() => {
fetch('/edit').then(response => response.json()).then(data => console.log(data)).catch(err => console.error(err));
}, [])



index.js (file)
import express from 'express';
import cors from 'cors';

app.use(cors());

const app = express();
const PORT = 5173;

app.listen(PORT, () => console.log(Server is running on ${PORT}));

app.get('/edit', (req, res) => {
const users = [{
name: 'Anes',
age: 19,
},
{
name: 'Dion',
age: 17,
}
]
res.json(users);

})

export default app;
Screenshot_2024-08-05_110701.png
Was this page helpful?