Cross-Origin Resource Sharing (CORS)¶
Compatibility |
CPython & MicroPython
|
Required Microdot source files |
|
Required external dependencies |
None
|
Examples |
The CORS extension provides support for Cross-Origin Resource Sharing
(CORS). CORS is a
mechanism that allows web applications running on different origins to access
resources from each other. For example, a web application running on
https://example.com can access resources from https://api.example.com.
To enable CORS support, create an instance of the
CORS class and configure the desired options.
Example:
from microdot import Microdot
from microdot.cors import CORS
app = Microdot()
cors = CORS(app, allowed_origins=['https://example.com'],
allow_credentials=True)