# Routing explaination

To create a route you'll need to provides somes informations&#x20;

* a route name \[required]
* a route path \[required]
* a boolean (isApp) we'll explain later
* a controller \[required]
* a function \[required but must be null]
* an params \[optional]

```json
{
            name: 'app',
            path: '',
            controller: "PlasmaController",
            isApp: true,
            function: null,
            params: null
        }
```

This is an exemple of a basic route in this case me create a route called "app" with a empty path meaning that it's the base route like "<http://mycdn/>"

We told plasma that this route need to be linked to "PlasmaController" without specified function (we'll see this later on Controller explaination) and we don't provide any parameters

```json
{
            name: 'user_show',
            path: 'users/show',
            controller: "UsersController",
            isApp: true,
            function: "show",
            params: [
                {
                    name: "id",
                    type: '(:any)'
                }
            ]
        }
```

Here we have an other route, called "user\_show" the path is "users/show" meaning that it'll look like this : "<http://mycdn/#users/show>"

We told plasma to route this to the UsersController and to execute the function "show" from that controller.&#x20;

We also have params here, they are parameters provided by the url , here we have 1 param.\
\
Each params has name and type here we named our param "id" and could be type any (meaning interger or string)&#x20;

The final result of that route should look like this : "<http://my.cdn/#users/show/1>"

### Warning

A route with param will be working ONLY of param are passed to the url. It the previous case that mean "#users/show" don't exist but "#users/show/1" exist. \
The same thing append if you give more params than the route need to handle.&#x20;
