1
1
# Hello World Google Cloud Endpoints for App Engine
2
2
3
3
This sample provides an example of a [ migration] [ 7 ] from the prior version of
4
- [ Google Cloud Endpoints Frameworks] [ 3 ] to new [ Google Cloud Endpoints Frameworks for App Engine] [ 8 ] .
4
+ [ Google Cloud Endpoints Frameworks] [ 3 ] to new
5
+ [ Google Cloud Endpoints Frameworks for App Engine] [ 8 ] using a
6
+ ** Discovery Document** . Additionally, this sample provides an example of using
7
+ the new App Engine Maven and Gradle plugins for deploying your Google App Engine
8
+ Standard applications.
9
+
5
10
This sample contains comments of how to use the prior Endpoints Frameworks as
6
11
well. For clarity, the prior Endpoints Frameworks and the new Endpoints
7
12
Frameworks are denoted as Endpoints Frameworks v1.0 and Endpoints Frameworks
@@ -22,10 +27,21 @@ process is explained [here][8] and a quickstart is provided [here][9].
22
27
- [ Google Cloud Endpoints Frameworks v1.0] [ 3 ]
23
28
24
29
## Build and Deployment Plugins
30
+ - [ Google App Engine Maven plugin] [ 14 ]
31
+ - [ Google App Engine Gradle plugin] [ 15 ]
32
+
33
+ ## Discovery Document and Client Library Generation Plugins
25
34
- [ Google Cloud Endpoints Frameworks Maven Plugin] [ 10 ]
26
35
- [ Google Cloud Endpoints Frameworks Gradle Plugin] [ 11 ]
27
36
28
37
## Setup
38
+ 1 . Change ` YOUR-PROJECT-ID ` with your project id in the hostname parameter
39
+ defined in either the Maven or Gradle build script. Hostname is used when a
40
+ discovery document is generated.
41
+
42
+ - Maven - pom.xml
43
+ - Gradle - build.gradle
44
+
29
45
1 . [ Optional] : User Authenticating with Google Accounts in Web Clients
30
46
31
47
1 . Update the ` WEB_CLIENT_ID ` in [ Constants.java] ( src/main/java/com/example/helloendpoints/Constants.java )
@@ -37,12 +53,16 @@ process is explained [here][8] and a quickstart is provided [here][9].
37
53
have registered in the
38
54
[ Credentials on Developers Console for OAuth 2.0 client IDs] [ 6 ] .
39
55
40
- 1 . [ Optional] : User Authenticating with Google Accounts in other Applications Types
56
+ 1 . [ Optional] : User Authenticating with Google Accounts in other Applications
57
+ Types
41
58
42
- - Inside [ Constants.java] ( src/main/java/com/example/helloendpoints/Constants.java ) you will find placeholders for Android
43
- applications using Google Accounts client IDs registered in the
59
+ - Inside [ Constants.java] ( src/main/java/com/example/helloendpoints/Constants.java )
60
+ you will find placeholders for Android applications using Google Accounts
61
+ client IDs registered in the
44
62
[ Credentials on Developers Console for OAuth 2.0 client IDs] [ 6 ] .
45
63
64
+ - Note: iOS support should work but has not been fully tested.
65
+
46
66
- These client IDs are used when defining annotation for this sample API
47
67
found in [ Greetings.java] ( src/main/java/com/example/helloendpoints/Greetings.java ) .
48
68
@@ -65,61 +85,66 @@ process is explained [here][8] and a quickstart is provided [here][9].
65
85
66
86
### Maven
67
87
68
- 1. Build a fresh binary by using:
69
-
70
- `mvn clean compile`
71
-
72
- 1. Run the application locally at [http://localhost:8080][5] by using:
88
+ 1. Build and Run the application locally at [http://localhost:8080][5] by using:
73
89
74
- `mvn appengine:run`
90
+ `mvn clean appengine:run`
75
91
76
92
1. Explore local server's API explorer by browsing to:
77
93
78
94
[http://localhost:8080/_ah/api/explorer][13]
79
95
80
- 1. Generate the client library located at `target/client-libs/helloworld-v1-java.zip`
81
- by using:
96
+ 1. Generate the discovery document located at
97
+ `target/discovery-docs/helloworld-v1-rest.discovery` by using:
98
+
99
+ `mvn endpoints-framework:discoveryDocs`
100
+
101
+ 1. Generate the client library located at
102
+ `target/client-libs/helloworld-v1-java.zip` by using:
82
103
83
104
`mvn endpoints-framework:clientLibs`
84
105
85
- 1. Deploy your application to Google App Engine by using:
106
+ 1. Build and Deploy your application to Google App Engine by using:
86
107
87
- `mvn appengine:deploy`
108
+ `mvn clean appengine:deploy`
88
109
89
110
### Gradle
90
111
91
- 1. Build a fresh binary by using:
92
-
93
- `gradle clean compileJava`
112
+ 1. Build and Run the application locally at [http://localhost:8080][5] by using:
94
113
95
- 1. Run the application locally at [http://localhost:8080][5] by using:
114
+ `./gradlew clean appengineRun`
96
115
97
- `gradle appengineRun `
116
+ Windows users: Use `gradlew.bat` instead of `./gradlew `
98
117
99
118
1. Explore local server's API explorer by browsing to:
100
119
101
120
[http://localhost:8080/_ah/api/explorer][13]
102
121
103
- 1. Generate the client library located at `build/endpointsClientLibs/helloworld-v1-java.zip`
104
- by using:
122
+ 1. Generate the discovery document located at
123
+ `build/endpointsDiscoveryDocs/helloworld-v1-rest.discovery` by using:
105
124
106
- `gradle endpointsClientLibs `
125
+ `./gradlew endpointsDiscoveryDocs `
107
126
108
- 1. Deploy your application to Google App Engine by using:
127
+ 1. Generate the client library located at
128
+ `build/endpointsClientLibs/helloworld-v1-java.zip` by using:
129
+
130
+ `./gradlew endpointsClientLibs`
109
131
110
- `gradle appengineDeploy`
132
+ 1. Deploy your application to Google App Engine by using:
111
133
134
+ `./gradlew appengineDeploy`
112
135
113
136
[1]: https://cloud.google.com/appengine/docs/java/
114
137
[2]: http://java.com/en/
115
- [3]: https://cloud.google.com/appengine /docs/java/endpoints/
138
+ [3]: https://cloud.google.com/endpoints /docs/frameworks/legacy/v1/java
116
139
[4]: https://cloud.google.com/appengine/docs/java/tools/maven
117
140
[5]: http://localhost:8080/
118
141
[6]: https://console.developers.google.com/project/_/apiui/credential
119
- [7]: https://cloud.google.com/appengine /docs/java/endpoints /migrating
142
+ [7]: https://cloud.google.com/endpoints /docs/frameworks/legacy/v1/java /migrating
120
143
[8]: https://cloud.google.com/endpoints/docs/frameworks/java/about-cloud-endpoints-frameworks
121
144
[9]: https://cloud.google.com/endpoints/docs/frameworks/java/quickstart-frameworks-java
122
145
[10]: https://github.com/GoogleCloudPlatform/endpoints-framework-maven-plugin
123
146
[11]: https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin
124
147
[12]: https://cloud.google.com/endpoints/docs/authenticating-users-frameworks
125
148
[13]: http://localhost:8080/_ah/api/explorer
149
+ [14]: https://github.com/GoogleCloudPlatform/app-maven-plugin
150
+ [15]: https://github.com/GoogleCloudPlatform/app-gradle-plugin
0 commit comments