diff --git a/build/router/controller/js.php b/build/router/controller/js.php
new file mode 100644
index 0000000..e96d9a4
--- /dev/null
+++ b/build/router/controller/js.php
@@ -0,0 +1,65 @@
+ Calling URI
+ *
+ */
+ public function __construct($url){
+ }
+
+
+ /* Generate _SERVER.js
+ *
+ */
+ public function server(){
+ header('Content-Type: text/javascript; charset=utf-8');
+
+ echo "window._SERVER = ".json_encode([
+
+ 'a' => [1, 2]
+
+ ])."\n";
+
+ }
+
+
+ /* Manage bundle hash
+ *
+ */
+ public function bundle(){
+
+ /* (1) Extract /public_html/js/ all .js files */
+ $js_scripts = glob(__PUBLIC__.'/js/*.js');
+
+ /* (2) If match pattern 'bundle@*.js' */
+ foreach($js_scripts as $fname){
+
+ $bname = basename($fname);
+
+ // if match -> load it and exit
+ if( preg_match('/bundle@[\da-f]+\.js/', $bname) )
+ header("Location: /js/$bname");
+
+ }
+
+ }
+
+ /* POST-CALL
+ *
+ */
+ public function __destruct(){
+
+ }
+
+
+
+ }
diff --git a/build/router/controller/page.php b/build/router/controller/page.php
index a2ff3ea..e774bd1 100755
--- a/build/router/controller/page.php
+++ b/build/router/controller/page.php
@@ -14,8 +14,8 @@
*
*/
public function __construct($url){
- $this->pagename = isset($url['page']) ? $url['page'] : null;
+ $this->pagename = $url['page'];
}
@@ -30,28 +30,6 @@
echo "page not found";
}
-
- /* Manage bundle hash
- *
- */
- public function bundle(){
-
- /* (1) Extract /public_html/js/ all .js files */
- $js_scripts = glob(__PUBLIC__.'/js/*.js');
-
- /* (2) If match pattern 'bundle@*.js' */
- foreach($js_scripts as $fname){
-
- $bname = basename($fname);
-
- // if match -> load it and exit
- if( preg_match('/bundle@[\da-f]+\.js/', $bname) )
- header("Location: /js/$bname");
-
- }
-
- }
-
/* POST-CALL
*
*/
diff --git a/config/routes.json b/config/routes.json
index 9c83a1e..c06c786 100755
--- a/config/routes.json
+++ b/config/routes.json
@@ -7,7 +7,13 @@
"/js/bundle.js": {
"methods": ["GET"],
- "controller": "page:bundle",
+ "controller": "js:bundle",
+ "arguments": {}
+ },
+
+ "/js/_SERVER.js": {
+ "methods": ["GET"],
+ "controller": "js:server",
"arguments": {}
},
diff --git a/view/home.php b/view/home.php
index a94f687..e5f7457 100755
--- a/view/home.php
+++ b/view/home.php
@@ -13,6 +13,10 @@
+
+
+
+