mcst/src/routes.php

24 lines
1.1 KiB
PHP

<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Views\Twig;
use BitGoblin\MCST\Minecraft\Server;
// index GET route - this page should welcome the user and direct them to the available actions
$app->get('/', '\\BitGoblin\\MCST\\Controllers\\HomeController:getIndex')->setName('index');
// create GET route - this page allows a user to create a new server instance
$app->get('/create', '\\BitGoblin\\MCST\\Controllers\\ServerController:getCreate')->setName('create');
// create POST route - processes the new server creation
$app->post('/create', '\\BitGoblin\\MCST\\Controllers\\ServerController:postCreate');
// server status route
$app->get('/server/{serverName}/status', '\\BitGoblin\\MCST\\Controllers\\ServerController:getStatus')->setName('server.status');
// server start route
$app->get('/server/{serverName}/start', '\\BitGoblin\\MCST\\Controllers\\ServerController:getStart')->setName('server.start');
// server stop route
$app->get('/server/{serverName}/stop', '\\BitGoblin\\MCST\\Controllers\\ServerController:getStop')->setName('server.stop');