GitHub Repository


Definition & Principles

Read from the Porto SAP Documentation (#Routes).


Folder Structure

 - app
    - Containers
        - {container-name}
            - UI
                - API
                   - Routes
                      - CreateItem.v1.public.php
                      - DeleteItem.v1.public.php
                      - CreateItem.v2.public.php
                      - DeleteItem.v1.private.php
                      - ApproveItem.v1.private.php
                      - ...
                - WEB
                   - Routes
                      - main.php
                      - ...

Web Routes

Example: Endpoint to display a Hello View in the browser


$router->get('/hello', [
    'uses' => 'Controller@sayHello',

In all the Web Routes files the $router variable is an instance of the default Laravel Router Illuminate\Routing\Router.

API Routes

Example: User Login API Endpoint


$router->post('login', [
    'uses' => 'Controller@loginUser',

Example: Protected List All Users API Endpoint, for an API Routes file


$router->get('users', [
    'uses'       => 'Controller@listAllUsers',
    'middleware' => [

Protect your Endpoints:

Checkout the Authorization Page.

Difference between Public & Private routes files

apiato has 2 types of endpoints, Public (External) mainly for third parties clients, and Private (Internal) for your own Apps. This will help generating separate documentations for each and keep your internal API private.