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:
+10
-1
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user