From 4073d8884ee08e6501efabbf021732bc5c5c72db Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 29 Aug 2021 00:52:12 +0200 Subject: [PATCH] Simplify routing setup --- composer.json | 2 +- src/main/php/com/amazon/aws/lambda/HttpApi.class.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index fcc94e7..c028bda 100755 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "require" : { "xp-framework/core": "^10.0 | ^9.0 | ^8.0 | ^7.0", "xp-forge/lambda": "^1.0", - "xp-forge/web": "^2.0", + "xp-forge/web": "^2.13", "php": ">=7.0.0" }, "require-dev" : { diff --git a/src/main/php/com/amazon/aws/lambda/HttpApi.class.php b/src/main/php/com/amazon/aws/lambda/HttpApi.class.php index 8e89a2a..c093ba0 100755 --- a/src/main/php/com/amazon/aws/lambda/HttpApi.class.php +++ b/src/main/php/com/amazon/aws/lambda/HttpApi.class.php @@ -33,15 +33,14 @@ public function target() { }); // Determine routing - $r= $this->routes(new Environment( + $routing= Routing::cast($this->routes(new Environment( getenv('PROFILE') ?: 'prod', $this->environment->root, $this->environment->path('static'), [$this->environment->properties], [], $logging - )); - $routing= $r instanceof Application ? $r->routing() : Routing::cast($r); + ))); // Return event handler return function($event, $context) use($routing, $logging) {