api-erstellen #1
+9
-1
@@ -78,7 +78,8 @@ fabric.properties
|
|||||||
.LSOverride
|
.LSOverride
|
||||||
|
|
||||||
# Icon must end with two \r
|
# Icon must end with two \r
|
||||||
Icon␍
|
Icon
|
||||||
|
|
||||||
|
|
||||||
# Thumbnails
|
# Thumbnails
|
||||||
._*
|
._*
|
||||||
@@ -99,3 +100,10 @@ Network Trash Folder
|
|||||||
Temporary Items
|
Temporary Items
|
||||||
.apdisk
|
.apdisk
|
||||||
|
|
||||||
|
/api/composer.lock
|
||||||
|
/api/codeception.yml
|
||||||
|
/api/vendor/
|
||||||
|
/api/tests/_*
|
||||||
|
/api/tests/acceptance
|
||||||
|
/api/tests/functional
|
||||||
|
/api/tests/*.suite.yml
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
FROM php:8.0-apache
|
||||||
|
|
||||||
|
WORKDIR /var/www
|
||||||
|
TorstenHettstedt marked this conversation as resolved
|
|||||||
|
|
||||||
|
RUN a2enmod rewrite
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "torsten-hettstedt/timekeeping-api",
|
||||||
|
"description": "REST-Api zum F\u00fcllen einer Tabelle f\u00fcr die Arbeitszeiterfassung.",
|
||||||
|
"keywords": [
|
||||||
|
"microframework",
|
||||||
|
"rest",
|
||||||
|
"router",
|
||||||
|
"psr7"
|
||||||
|
],
|
||||||
|
"license": "GPL-2.0-or-later",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Torsten Lücke",
|
||||||
|
"email": "arbeit@torsten-hettstedt.de",
|
||||||
|
"homepage": "http://torsten-hettstedt.de/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"slim/slim": "^4.7.1",
|
||||||
|
"vlucas/phpdotenv": "^4.2",
|
||||||
|
"slim/psr7": "^1.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpstan/phpstan": "^0.12.80",
|
||||||
|
"codeception/codeception": "^4.1.18",
|
||||||
|
"codeception/module-phpbrowser": "^1.0.0",
|
||||||
|
"codeception/module-asserts": "^1.0.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"TorstenHettstedt\\TimekeepingApi\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"TorstenHettstedt\\TimekeepingApi\\Tests\\Unit\\": "tests/unit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
# Some hosts may require you to use the `RewriteBase` directive.
|
||||||
|
# Determine the RewriteBase automatically and set it as environment variable.
|
||||||
|
# If you are using Apache aliases to do mass virtual hosting or installed the
|
||||||
|
# project in a subdirectory, the base path will be prepended to allow proper
|
||||||
|
# resolution of the index.php file and to redirect to the correct URI. It will
|
||||||
|
# work in environments without path prefix as well, providing a safe, one-size
|
||||||
|
# fits all solution. But as you do not need it in this case, you can comment
|
||||||
|
# the following 2 lines to eliminate the overhead.
|
||||||
|
RewriteRule ^(.*) - [E=BASE:%1]
|
||||||
|
|
||||||
|
# If the above doesn't work you might need to set the `RewriteBase` directive manually, it should be the
|
||||||
|
# absolute physical path to the directory that contains this htaccess file.
|
||||||
|
# RewriteBase /
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^ index.php [QSA,L]
|
||||||
|
</IfModule>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
|
use Slim\Factory\AppFactory;
|
||||||
|
|
||||||
|
$app = AppFactory::create();
|
||||||
|
|
||||||
|
$app->get('/', 'TorstenHettstedt\TimekeepingApi\Controller\HelloWorldController:read');
|
||||||
|
|
||||||
|
$app->addErrorMiddleware(true, true, true);
|
||||||
|
|
||||||
|
$app->run();
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php /** @noinspection PhpUnused */
|
||||||
|
|
||||||
|
|
||||||
|
namespace TorstenHettstedt\TimekeepingApi\Controller;
|
||||||
|
|
||||||
|
use Slim\Psr7\Response;
|
||||||
|
use Slim\Psr7\Request;
|
||||||
|
|
||||||
|
class HelloWorldController
|
||||||
|
{
|
||||||
|
/** @noinspection PhpUnusedParameterInspection */
|
||||||
|
public function read(Request $request, Response $response, $args): Response
|
||||||
|
{
|
||||||
|
$payload = json_encode('Hallo World');
|
||||||
|
|
||||||
|
$response->getBody()->write($payload);
|
||||||
|
|
||||||
|
return $response
|
||||||
|
->withHeader('Content-Type', 'application/json')
|
||||||
|
->withStatus(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
volumes:
|
||||||
|
logs:
|
||||||
|
driver: local
|
||||||
|
services:
|
||||||
|
api:
|
||||||
|
build: ./api/
|
||||||
|
environment:
|
||||||
|
docker: "true"
|
||||||
|
ports:
|
||||||
|
- 8090:80
|
||||||
|
volumes:
|
||||||
|
- ./api:/var/www
|
||||||
|
- logs:/var/www/logs
|
||||||
Reference in New Issue
Block a user
Kann weg.