forked from msantang78/minds-phpconsole
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.php
More file actions
27 lines (19 loc) · 673 Bytes
/
Copy pathserver.php
File metadata and controls
27 lines (19 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
require 'autoload.php';
Autoloader::register('MindsConsole\\Controllers\\', 'controllers');
Autoloader::register('MindsConsole\\Core\\', 'core');
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
if ($uri !== '/' && file_exists(__DIR__.'/build/'.$uri)) {
return false;
}
/**
* Create router, define rutes and dispatch the request
*/
$router = new MindsConsole\Core\Router(new MindsConsole\Core\Request);
$router
->define('', 'get', ['HomeController', 'index']) // home route /
->define('api/execute', 'post', ['ExecuteController', 'run'])
->define('api/lint', 'post', ['ExecuteController', 'lint'])
->dispatch();