CORS (Cross-Origin Resource Sharing) je mehanizam sigurnosti preglednika koji kontrolira može li web stranica s jednog origin-a pozivati vaš API na drugom origin-u. FastAPI ga konfigurira ugrađenim CORSMiddleware. Trebat ćete CORS svaki put kad frontend na drugoj domeni/portu poziva vaš API.
Problem koji CORS rješava
A React app at http://localhost:3000 calling an API at http://localhost:8000 is
CROSS-ORIGIN (different port). The BROWSER blocks the response unless the API
sends CORS headers permitting that origin.
(origin = scheme + host + port)
