Skip to content

Commit 186b1eb

Browse files
author
Ace Nassri
authored
Merge pull request GoogleCloudPlatform#1283 from GoogleCloudPlatform/fix-dep-tests
chore(appengine): fix failing deployment tests
2 parents d1a1f0f + 7a30ded commit 186b1eb

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file specifies files that are *not* uploaded to Google Cloud Platform
2+
# using gcloud. It follows the same syntax as .gitignore, with the addition of
3+
# "#!include" directives (which insert the entries of the given .gitignore-style
4+
# file at that point).
5+
#
6+
# For more information, run:
7+
# $ gcloud topic gcloudignore
8+
#
9+
.gcloudignore
10+
# If you would like to upload your .git directory, .gitignore file or files
11+
# from your .gitignore file, remove the corresponding line
12+
# below:
13+
.git
14+
.gitignore
15+
16+
# PHP Composer dependencies:
17+
/vendor/
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"require": {
3-
"slim/slim": " ^4.0"
3+
"slim/slim": " ^4.0",
4+
"slim/psr7": "^1.3"
45
}
56
}

appengine/standard/slim-framework/index.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,20 @@
2222
*/
2323
require 'vendor/autoload.php';
2424

25+
use Psr\Http\Message\ResponseInterface as Response;
26+
use Psr\Http\Message\ServerRequestInterface as Request;
27+
use Slim\Factory\AppFactory;
28+
2529
# [START gae_slim_front_controller]
26-
$app = new Slim\App();
27-
$app->get('/', function ($request, $response) {
30+
$app = AppFactory::create();
31+
$app->addRoutingMiddleware();
32+
33+
$app->get('/', function (Request $request, Response $response) {
2834
// Use the Null Coalesce Operator in PHP7
2935
// http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.coalesce
3036
$name = $request->getQueryParams()['name'] ?? 'World';
31-
return $response->getBody()->write("Hello, $name!");
37+
$response->getBody()->write("Hello, $name!");
38+
return $response;
3239
});
3340
$app->run();
3441
# [END gae_slim_front_controller]

0 commit comments

Comments
 (0)