Skip to content

Instantly share code, notes, and snippets.

@vrngupta53
Last active February 16, 2020 15:21
Show Gist options
  • Save vrngupta53/a88d27d4e5a05dc3dde7aa341b94e3c4 to your computer and use it in GitHub Desktop.
Save vrngupta53/a88d27d4e5a05dc3dde7aa341b94e3c4 to your computer and use it in GitHub Desktop.
serves all routes from localhost:8000/1 to localhost:8000/100000000
#!/bin/bash
mkdir -p chapo/public chapo/app/controllers
echo '{"require": {"torophp/torophp": "dev-master"},"autoload":{"classmap":["app"]}}' >> chapo/composer.json
echo '<?php
require __DIR__."/../vendor/autoload.php";
Toro::serve(array(' >> chapo/public/index.php
for i in {1..100000000}
do
echo -n "
'/$i' => '\Handler'" >> chapo/public/index.php
if [ $i != 100000000 ]
then
echo "," >> chapo/public/index.php
fi
done
echo "));" >> chapo/public/index.php
echo '<?php
class Handler{public function get(){echo "chapo kab??";}}' >> chapo/app/controllers/handler.php
cd chapo
curl -s https://getcomposer.org/installer | php
php composer.phar install
composer dump-autoload
cd public
php -S localhost:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment