Initial commit: Slim Framework 4 API Retribusi dengan modular architecture
This commit is contained in:
34
src/Bootstrap/app.php
Normal file
34
src/Bootstrap/app.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Bootstrap;
|
||||
|
||||
use Slim\App;
|
||||
use Slim\Factory\AppFactory;
|
||||
use Slim\Middleware\BodyParsingMiddleware;
|
||||
|
||||
class AppBootstrap
|
||||
{
|
||||
/**
|
||||
* Create and configure Slim App instance
|
||||
*
|
||||
* @return App
|
||||
*/
|
||||
public static function create(): App
|
||||
{
|
||||
$app = AppFactory::create();
|
||||
|
||||
// Add body parsing middleware
|
||||
$app->addBodyParsingMiddleware();
|
||||
|
||||
// Add routing middleware
|
||||
$app->addRoutingMiddleware();
|
||||
|
||||
// Add error middleware
|
||||
$app->addErrorMiddleware(true, true, true);
|
||||
|
||||
return $app;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user