🖥️
SIM-REST
  • Overview
  • Getting Started
  • Authentication
  • Routes
    • Methods
    • Protected Routes
  • Database
    • DB Query
  • Filter data
  • Helper
  • Session
Powered by GitBook
On this page

Was this helpful?

  1. Routes

Protected Routes

To protect routes, keep the routes inside if statement as below

if($auth->routes()){

  // Protect routes must be in this if statment
  
  $router->get("/protected-route",function(){
     echo "You've just accessed the protected route";
  })

}

Access Protected Route with Token

HEAD -/protected-route

Headers

Name
Type
Description

Authorization

string

Bearer Token

{
  "status":200,
  "message:"Succefully retrieved data",
  "data":[..]
}

You must have token to access protected routes.

PreviousMethodsNextDatabase

Last updated 5 years ago

Was this helpful?

To generate a token, see under

Authentication section.