]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/server/falcon/server.py
allow to add php-compatible endpoints
[nominatim.git] / nominatim / server / falcon / server.py
index ddbd2ca64f1b2fcaf2c6b53411f4320bc2cefd81..080650e7f00911e9070e6284432d4dc2f6357a7d 100644 (file)
@@ -65,8 +65,13 @@ def get_application(project_dir: Path,
     """
     api = NominatimAPIAsync(project_dir, environ)
 
-    app = App()
+    app = App(cors_enable=api.config.get_bool('CORS_NOACCESSCONTROL'))
+
+    legacy_urls = api.config.get_bool('SERVE_LEGACY_URLS')
     for name, func in api_impl.ROUTES:
-        app.add_route('/' + name, EndpointWrapper(func, api))
+        endpoint = EndpointWrapper(func, api)
+        app.add_route(f"/{name}", endpoint)
+        if legacy_urls:
+            app.add_route(f"/{name}.php", endpoint)
 
     return app