Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('DB_HOST', 'db.service');
- define('DB_USER', 'docker');
- define('DB_PASS', 'mysql');
- use \Amp\Loop;
- use \Amp\Mysql\Pool;
- use Aerys\{ Host, Request, Response, Websocket, function root, function router, function websocket };
- return (new \Aerys\Host)->expose("*", 1337)->use(
- function(Request $req, Response $res) {
- $strConn = "host=".DB_HOST.";user=".DB_USER.";pass=".DB_PASS;
- $sql = "SELECT * from mysql.user";
- $pool = new Pool($strConn);
- $resultSet = yield $pool->query($sql);
- $rows = yield $resultSet->fetchAll();
- $res->end("<html><body><h1>Fallback \o/</h1><p>".$sql."</p><p>Found: ". count($rows)." rows</p></body></html>");
- });
Add Comment
Please, Sign In to add comment