Added in ability to add a new project with and without an image

Signed-off-by: rodude123 <rodude123@gmail.com>
This commit is contained in:
2023-02-06 01:26:35 +00:00
parent db7c12857e
commit fd64eb92b0
10 changed files with 413 additions and 91 deletions
+10 -1
View File
@@ -2,11 +2,14 @@
// middleware
namespace api;
session_start();
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Slim\App;
use Selective\SameSiteCookie\SameSiteCookieConfiguration;
use Selective\SameSiteCookie\SameSiteCookieMiddleware;
use Slim\Exception\HttpInternalServerErrorException;
use Slim\Exception\HttpMethodNotAllowedException;
use Slim\Exception\HttpNotFoundException;
use Slim\Psr7\Response;
@@ -76,7 +79,7 @@ class middleware
$app->add(new JwtAuthentication([
"rules" => [
new RequestPathRule([
"path" => ["/api/projectData", "/api/timeline/[a-z]*", "/api/user/testMethod"],
"path" => ["/api/projectData", "/api/timeline/[a-z]*", "/api/logout"],
"ignore" => ["/api/contact", "/api/user/login", "/api/user/changePassword"]
]),
new RequestMethodRule([
@@ -114,6 +117,12 @@ class middleware
$response->getBody()->write(json_encode(array("status" => "405", "message" => "Method not allowed")));
return $response;
}
catch (HttpInternalServerErrorException $exception)
{
$response = (new Response())->withStatus(500);
$response->getBody()->write(json_encode(array("status" => "500", "message" => $exception->getMessage())));
return $response;
}
});
$app->addErrorMiddleware(true, true, true);