# Routes

## How to add routes?

Routes must be declare inside **index.php**

## $router Parameters

* First parameter = **route**
* Second parameter = **function**

```javascript
$router->get(
  '/home', // home route
  function(){} // function
);
```

## Declare a simple GET method route

Add /**about** route in `index.php` as below

```javascript
/**
 * About Page
 */
$router->get('/about',function(){
    echo "Welcome to about page";
});
```

## Point to views folder

You can require normal php file as below

```javascript
/**
* Require File
*/
$router->get('/about',function(){
  require __DIR__ . '/views/about.php';
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ronaldaug.gitbook.io/sim-rest/routes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
