CORS
Lesson 15 of 20 · API.Micro
Why a browser may refuse to show your page an API response.
{"id": 2, "name": "Latte", "price": 4, "category": "coffee"}
JavaScript on the café website calls the API. The browser adds Origin, and the API answers Access-Control-Allow-Origin for sites it trusts.
Check yourself
Who enforces CORS?
Do it in the browser: a real REST APIs tool, a short mission and instant feedback. No install.
Start this lesson — free