<commit_before><?php
/**
 * Created by PhpStorm.
 * User: laogui
 * Date: 17/5/9
 * Time: 下午5:47
 */

require dirname(__FILE__)."/vendor/autoload.php";

$app = new \Sukui\Application();

$app->addMiddleware(function(\Sukui\ServerContext $ctx) {
    $ctx->status = 200;
    $ctx->body = "<h1>Hello World</h1>";
});

$app->listen();<commit_msg>update server<commit_after><?php
/**
 * Created by PhpStorm.
 * User: laogui
 * Date: 17/5/9
 * Time: 下午5:47
 */

require dirname(__FILE__)."/vendor/autoload.php";



$router = new \Sukui\Router();

$router->get("/user/{id:\d+}",function (\Sukui\ServerContext $context,$next,$vars){
        $context->body = "user={$vars['id']}";
});


$router->addRoute(["GET","POST"],"/test",function (\Sukui\ServerContext $context,$next,$vars){
    $context->body = "test";
});

$router->get("/timeout",function (\Sukui\ServerContext $context,$next,$vars){
    yield async_sleep(1000);
});


$router->addGroup("/admin",function(\FastRoute\RouteCollector $router){
    $router->addRoute("GET","/test1",function (\Sukui\ServerContext $context,$next,$vars){
        $context->body = "admin/test1";
    });

    $router->addRoute("GET","/test2",function (\Sukui\ServerContext $context,$next,$vars){
        $context->body = "admin/test2 with ".json_encode($vars);
    });
});


$app = new \Sukui\Application();

$app->addMiddleware(new \Sukui\Middleware\RequestTimeout(200));

$app->addMiddleware($router->routes());

$app->addMiddleware(new \Sukui\Middleware\NotFound());

$app->listen();
{'fraction_non_alphanumeric': 0.2267019167217449, 'fraction_numerical': 0.01982815598149372, 'mean_word_length': 4.670411985018727, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1239329', 'n_tokens_mistral': 555, 'n_tokens_neox': 543, 'n_words': 76}