You've already forked Php-Template
refactor: update server initialization to use Config facade and improve error handling
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m27s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m32s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m37s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 1m47s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m41s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 52s
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m27s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m32s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m37s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 1m47s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m41s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 52s
This commit is contained in:
@@ -4,11 +4,11 @@ use Siteworxpro\App\Server;
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
// Instantiate the ExternalServer class
|
||||
$server = new Server();
|
||||
|
||||
// Start the server
|
||||
try {
|
||||
// Instantiate the ExternalServer class
|
||||
$server = new Server();
|
||||
|
||||
// Start the server
|
||||
$server->startServer();
|
||||
} catch (JsonException $e) {
|
||||
echo $e->getMessage();
|
||||
|
||||
@@ -10,6 +10,7 @@ use League\Route\Http\Exception\MethodNotAllowedException;
|
||||
use League\Route\Http\Exception\NotFoundException;
|
||||
use League\Route\Router;
|
||||
use Nyholm\Psr7\Factory\Psr17Factory;
|
||||
use Siteworx\Config\Config as SWConfig;
|
||||
use Siteworxpro\App\Controllers\IndexController;
|
||||
use Siteworxpro\App\Http\JsonResponseFactory;
|
||||
use Siteworxpro\App\Http\Middleware\CorsMiddleware;
|
||||
@@ -52,6 +53,7 @@ class Server
|
||||
* Server constructor.
|
||||
*
|
||||
* Initializes the server by booting the PSR-7 worker and router.
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -74,8 +76,8 @@ class Server
|
||||
Facade::setFacadeContainer($container);
|
||||
|
||||
// Bind the container to the Config facade first so that it can be used by service providers
|
||||
$container->bind(\Siteworx\Config\Config::class, function () {
|
||||
return \Siteworx\Config\Config::load(__DIR__ . '/../config.php');
|
||||
$container->bind(SWConfig::class, function () {
|
||||
return SWConfig::load(__DIR__ . '/../config.php');
|
||||
});
|
||||
|
||||
foreach (self::$serviceProviders as $serviceProvider) {
|
||||
|
||||
Reference in New Issue
Block a user