File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed
appengine/standard/slim-framework Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change 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/
Original file line number Diff line number Diff line change 11{
22 "require" : {
3- "slim/slim" : " ^4.0"
3+ "slim/slim" : " ^4.0" ,
4+ "slim/psr7" : " ^1.3"
45 }
56}
Original file line number Diff line number Diff line change 2222 */
2323require '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]
You can’t perform that action at this time.
0 commit comments