Created
December 28, 2015 19:26
-
-
Save lleitep3/7bfa7590801eed031e7d to your computer and use it in GitHub Desktop.
script de web server quebra galho com rewrite para meu ambiente de dev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* To run PHP server just paste the code bellow in root path : | |
* $ php -S 0.0.0.0:8080 -t ./public -f webServer.php | |
**/ | |
if (preg_match('/\.css|\.js|\.jpg|\.png|\.map$/', $_SERVER['REQUEST_URI'], $match)) { | |
$mimeTypes = [ | |
'.css' => 'text/css', | |
'.js' => 'application/javascript', | |
'.jpg' => 'image/jpg', | |
'.png' => 'image/png', | |
'.map' => 'application/json' | |
]; | |
$path = __DIR__ . $_SERVER['REQUEST_URI']; | |
if (is_file($path)) { | |
header("Content-Type: {$mimeTypes[$match[0]]}"); | |
require $path; | |
exit; | |
} | |
} | |
require_once __DIR__.'/../app/bootstrap.php'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment