mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-13 06:14:07 +00:00
add support for CORS headers
Adds the additional dependency to sanic-cors for the Sanic server.
This commit is contained in:
@@ -58,6 +58,10 @@ def get_application(project_dir: Path,
|
||||
|
||||
app.ctx.api = NominatimAPIAsync(project_dir, environ)
|
||||
|
||||
if app.ctx.api.config.get_bool('CORS_NOACCESSCONTROL'):
|
||||
from sanic_cors import CORS # pylint: disable=import-outside-toplevel
|
||||
CORS(app)
|
||||
|
||||
for name, func in api_impl.ROUTES:
|
||||
app.add_route(_wrap_endpoint(func), f"/{name}", name=f"v1_{name}_simple")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user