PHP Classes

File: api/index.php

Recommend this page to a friend!
  Classes of Okanlawon Anuoluwapo   PHP MongoDB CRUD Example of API   api/index.php   Download  
File: api/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP MongoDB CRUD Example of API
API that provides CRUD operations with MongoDB
Author: By
Last change:
Date: 8 months ago
Size: 301 bytes
 

Contents

Class file image Download
<?php
require __DIR__ . '/config.php';

$user = new User();

if (
$_SERVER['REQUEST_METHOD'] === "GET" ) :
    try {
       
$result = $user->findAllUser();
       
//
       
HttpResponse::OK($result);
    } catch (\
Throwable $th) {
       
HttpResponse::badRequest($th->getMessage());
    }
endif;