🖥️
SIM-REST
  • Overview
  • Getting Started
  • Authentication
  • Routes
    • Methods
    • Protected Routes
  • Database
    • DB Query
  • Filter data
  • Helper
  • Session
Powered by GitBook
On this page
  • How to add routes?
  • $router Parameters
  • Declare a simple GET method route
  • Point to views folder

Was this helpful?

Routes

How to add routes?

Routes must be declare inside index.php

$router Parameters

  • First parameter = route

  • Second parameter = function

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

Declare a simple GET method route

Add /about route in index.php as below

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

Point to views folder

You can require normal php file as below

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

PreviousAuthenticationNextMethods

Last updated 5 years ago

Was this helpful?