diff --git a/src/BobDBuilder/Cmd/Traits/Make/Domain.php b/src/BobDBuilder/Cmd/Traits/Make/Domain.php index 5d12274..1aa150c 100644 --- a/src/BobDBuilder/Cmd/Traits/Make/Domain.php +++ b/src/BobDBuilder/Cmd/Traits/Make/Domain.php @@ -89,6 +89,9 @@ public function domain(): void $this->talk("- Linking shared directory *{$this->plug->server->shared}*"); new BobExec("link:dir web{$this->plug->s}shared web{$this->plug->s}domains{$this->plug->s}$domain{$this->plug->s}shared --silent"); + $this->talk("- Linking Api domain to new domain *{$this->plug->server->domains}Api*"); + new BobExec("link:dir web{$this->plug->s}domains{$this->plug->s}Api web{$this->plug->s}domains{$this->plug->s}$domain{$this->plug->s}api --silent"); + $this->talk("- Updating domains entry in *{$this->plug->server->web}index.php*"); $this->update_general_domain_entry($domain, $domain_id, $pattern); } diff --git a/src/Core/Api/ApiEngine.php b/src/Core/Api/ApiEngine.php index 4cfa534..6bfcd77 100644 --- a/src/Core/Api/ApiEngine.php +++ b/src/Core/Api/ApiEngine.php @@ -7,7 +7,6 @@ use BrickLayer\Lay\Core\Api\Enums\ApiRequestMethod; use BrickLayer\Lay\Core\Exception; -// TODO: Implement Middleware Handler final class ApiEngine { public static function new() : self { return new self(); @@ -40,7 +39,7 @@ private function correct_request_method(bool $throw_exception = true) : bool { self::exception( "UnmatchedRequestMethod", "Request method for api request [". self::$request_uri_raw ."]; don't match. - Check if you have binded you route to a method, it could be using the method of the previous route" + Check if you have bound you route to a method, it could be using the method of the previous route" ); return false; @@ -268,8 +267,8 @@ public function print_as_json(bool $print = true) : string|bool|null { $x = json_encode(self::$method_return_value); if($print) { - print_r($x); header("Content-Type: application/json"); + print_r($x); die; } @@ -277,7 +276,7 @@ public function print_as_json(bool $print = true) : string|bool|null { } /** - * Get the mapped out arguments of a current `->for` case + * Get the mapped-out arguments of a current `->for` case * @return array */ public function get_mapped_args() : array { diff --git a/src/Core/Traits/Init.php b/src/Core/Traits/Init.php index 7d2743c..62bef4f 100644 --- a/src/Core/Traits/Init.php +++ b/src/Core/Traits/Init.php @@ -7,6 +7,7 @@ trait Init { private static string $dir; private static string $base; + private static string $proto; private static string $base_no_proto; private static string $base_no_proto_no_www; private static string $env_host; @@ -25,6 +26,7 @@ private static function init_first_class() : void { private static function set_web_root(&$options) : void { $options['base'] = self::$base; + $options['proto'] = self::$proto; $options['base_no_proto'] = self::$base_no_proto; $options['base_no_proto_no_www'] = self::$base_no_proto_no_www; @@ -93,6 +95,7 @@ private static function first_class_citizens() : void { if($http_host != "cli") self::$LAY_MODE = LayMode::HTTP; + self::$proto = $proto; self::$base = $proto . $http_host . $base_no_proto . "/"; self::$base_no_proto = $http_host . $base_no_proto; self::$base_no_proto_no_www = str_replace("www.","", $base_no_proto); diff --git a/src/Core/Traits/Resources.php b/src/Core/Traits/Resources.php index 43d641e..bd84702 100644 --- a/src/Core/Traits/Resources.php +++ b/src/Core/Traits/Resources.php @@ -87,6 +87,7 @@ public static function server_data() : object #[ObjectShape([ "base" => 'string', + "proto" => 'string', "base_no_proto" => 'string', "base_no_proto_no_www" => 'string', "domain" => 'string',