Cross-Origin Resource Sharing (CORS) support (Fixes #45)

This commit is contained in:
Miguel Grinberg
2023-03-23 00:02:20 +00:00
parent ea6766cea9
commit 67798f7dbf
6 changed files with 325 additions and 0 deletions

1
examples/cors/README.md Normal file
View File

@@ -0,0 +1 @@
This directory contains Cross-Origin Resource Sharing (CORS) examples.

14
examples/cors/app.py Normal file
View File

@@ -0,0 +1,14 @@
from microdot import Microdot
from microdot_cors import CORS
app = Microdot()
CORS(app, allowed_origins=['https://example.org'], allow_credentials=True)
@app.route('/')
def index(request):
return 'Hello World!'
if __name__ == '__main__':
app.run()