CORS (Cross-Origin Resource Sharing) एक browser security mechanism है जो नियंत्रित करता है कि क्या एक origin से एक web page आपके API को एक अलग origin पर कॉल कर सकता है। FastAPI इसे built-in CORSMiddleware के साथ configure करता है। जब भी एक अलग domain/port पर एक frontend आपके API को कॉल करता है तो आप CORS से सामना करेंगे।
वह समस्या जिसे CORS संबोधित करता है
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)
