<commit_before># rest-recipes


## Router

Routes a request to specific endpoint and extracts variables

A route must begin with '/'.

The order of the parameters of the route and the parameters of the routeFunction
should be the same.

The order of routes must be in a order like:

- /recipe/
- /recipe/create (e.g. default data and id as response)
- /recipe/create/&lt;name&gt; (specific name for creation and id as response)
- /recipe/&lt;id&gt;
- /recipe/&lt;id&gt;/export
- /recipe/&lt;id&gt;/&lt;someVar&gt;<commit_msg>readme update<commit_after># rest-recipes


## Router

Routes a request to specific endpoint and extracts variables.

A route must begin with '/'.

The order of the parameters of the route and the parameters of the routeFunction
should be the same.

The order of routes must be in a order like:

- /recipe/
- /recipe/create (e.g. default data and id as response)
- /recipe/create/&lt;name&gt; (specific name for creation and id as response)
- /recipe/&lt;id&gt;
- /recipe/&lt;id&gt;/export
- /recipe/&lt;id&gt;/&lt;someVar&gt;

### Usage

```php
<?php
/**
 * api.php
 *
 * @version 0.1
 *
 */

require_once "RestRecipes/autoload.php";

use RestRecipes/Router;

$app = new Router();

// Index
$app->route("/recipe/", "GET", function() {
    
});

// Detail
$app->route("/recipe/<id>", "GET", function($id) {
    
});
```

The default querySelector of the Router class is `$q`. You can call the api
like this:

```
GET api.php?q=/recipe/
GET api.php?q=/recipe/3
```

{'fraction_non_alphanumeric': 0.14775016789791806, 'fraction_numerical': 0.0020147750167897917, 'mean_word_length': 3.5987654320987654, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '5464137', 'n_tokens_mistral': 538, 'n_tokens_neox': 524, 'n_words': 173}