Skip to content

Commit 0b94ba0

Browse files
wmwongTakashi Matsuo
authored andcommitted
Merges endpoints.html.twig with the README for the Endpoints sample. (GoogleCloudPlatform#192)
To actually use the endpoints, you need to use `gcloud beta app deploy` as of Oct 12, 2016. When we really use the endpoints, the paths which are not defined in the `swagger.yaml` will just 404, so we should move the useful info into the `README`.
1 parent 02e3daa commit 0b94ba0

File tree

6 files changed

+76
-295
lines changed

6 files changed

+76
-295
lines changed

appengine/flexible/endpoints/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ Run the application:
2121

2222
$ php -S localhost:8080
2323

24-
In your web browser, go to the following address: http://localhost:8080.
25-
2624
### Using the echo client
2725

2826
With the app running locally, you can execute the simple echo client using:
@@ -38,7 +36,7 @@ Open the `swagger.yaml` file and in the `host` property, replace
3836

3937
Then, deploy the sample using `gcloud`:
4038

41-
gcloud app deploy
39+
gcloud beta app deploy
4240

4341
Once deployed, you can access the application at https://YOUR-PROJECT-ID.appspot.com/
4442
or run the command `gcloud app browse`.
@@ -92,3 +90,17 @@ To use the client ID for authentication:
9290
Now you can use the client ID to make requests to the API:
9391

9492
$ php endpoints.php make-request https://YOUR-PROJECT-ID.appspot.com YOUR-API-KEY /path/to/client-secrets.json
93+
94+
95+
## Viewing the Endpoints graphs
96+
97+
By using Endpoints, you get access to several metrics that are displayed graphically in the Cloud Console.
98+
99+
To view the Endpoints graphs:
100+
101+
1. Go to the [Endpoints section in Cloud Console](https://console.cloud.google.com/endpoints) of the project you deployed your API to.
102+
2. Click on your API to view more detailed information about the metrics collected.
103+
104+
## Swagger UI
105+
106+
The Swagger UI is an open source Swagger project that allows you to explore your API through a UI. Find out more about it on the [Swagger site](http://swagger.io/swagger-ui/).

appengine/flexible/endpoints/app.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,10 @@
2323
*/
2424

2525
use Silex\Application;
26-
use Silex\Provider\TwigServiceProvider;
2726
use Symfony\Component\HttpFoundation\Request;
28-
use Symfony\Component\Yaml\Yaml;
2927

3028
// create the Silex application
3129
$app = new Application();
32-
$app->register(new TwigServiceProvider());
33-
$app['twig.path'] = [ __DIR__ ];
34-
35-
$app->get('/', function () use ($app) {
36-
/** @var Twig_Environment $twig */
37-
$twig = $app['twig'];
38-
39-
// Shows the index page
40-
return $app['twig']->render('endpoints.html.twig');
41-
});
42-
43-
$app->get('/api-docs', function () use ($app) {
44-
// Serves up the Swagger spec for the API.
45-
$swaggerText = file_get_contents(__DIR__ . '/swagger.yaml');
46-
$swaggerArray = Yaml::parse($swaggerText);
47-
48-
return $app->json($swaggerArray);
49-
});
5030

5131
$app->post('/echo', function () use ($app) {
5232
// Simple echo service.

appengine/flexible/endpoints/composer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"require": {
33
"silex/silex": " ^1.3",
4-
"twig/twig": "~1.8|~2.0",
5-
"symfony/twig-bridge": " ~2.7|3.0.*",
6-
"symfony/yaml": "^3.0",
74
"symfony/console": " ^3.0",
85
"google/auth": " 0.7"
96
},

0 commit comments

Comments
 (0)