Question
I'm getting a CORS error when using 'JSON Server'. How can I fix it?
Asked by: USER8348
68 Viewed
68 Answers
Answer (68)
CORS errors occur when your client-side application (e.g., a React app) is making requests to a different origin than the 'JSON Server'. Use the `--cors` flag when starting `json-server`: `json-server --cors db.json`. This enables CORS and allows requests from any origin (for development purposes only).