|
| 1 | +# Hello World Google Cloud Endpoints for App Engine with a discovery document |
| 2 | + |
| 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] |
| 5 | +while still using a discovery document. This sample contains comments of how to |
| 6 | +use the prior Endpoints Frameworks as well. For clarity, the prior Endpoints |
| 7 | +Frameworks and the new Endpoints Frameworks are denoted as Endpoints Frameworks v1.0 |
| 8 | +and Endpoints Frameworks v2.0 respectively. |
| 9 | + |
| 10 | +Google Cloud Endpoints Frameworks v2.0 provides new functionality which may |
| 11 | +require payment and uses an OpenAPI specification instead of the discovery document. |
| 12 | +The OpenAPI development process is explained [here][8] and a quickstart is |
| 13 | +provided [here][9]. |
| 14 | + |
| 15 | +## Products |
| 16 | +- [Google App Engine Standard][1] |
| 17 | + |
| 18 | +## Language |
| 19 | +- [Java][2] |
| 20 | + |
| 21 | +## APIs |
| 22 | +- [Google Cloud Endpoints Frameworks v2.0][8] |
| 23 | +- [Google Cloud Endpoints Frameworks v1.0][3] |
| 24 | + |
| 25 | +## Build and Deployment Plugins |
| 26 | +- [Google Cloud Endpoints Frameworks Maven Plugin][10] |
| 27 | +- [Google Cloud Endpoints Frameworks Gradle Plugin][11] |
| 28 | + |
| 29 | +## Setup |
| 30 | +1. [Optional]: User Authenticating with Google Accounts in Web Clients |
| 31 | + |
| 32 | + 1. Update the `WEB_CLIENT_ID` in [Constants.java](src/main/java/com/example/helloendpoints/Constants.java) |
| 33 | + to reflect the web client ID you have registered in the [Credentials on Developers Console for OAuth 2.0 client IDs][6]. |
| 34 | + |
| 35 | + 1. Update the value of `google.devrel.samples.helloendpoints.CLIENT_ID` in [base.js](src/main/webapp/js/base.js) |
| 36 | + to reflect the web client ID you have registered in the [Credentials on Developers Console for OAuth 2.0 client IDs][6]. |
| 37 | + |
| 38 | +1. [Optional]: User Authenticating with Google Accounts in other Applications Types |
| 39 | + |
| 40 | + - Inside [Constants.java](src/main/java/com/example/helloendpoints/Constants.java) you will find placeholders for Android |
| 41 | + and iOS applications using Google Accounts client IDs registered in the |
| 42 | + [Credentials on Developers Console for OAuth 2.0 client IDs][6]. |
| 43 | + |
| 44 | + - These client IDs are used when defining annotation for this sample API found in [Greetings.java](src/main/java/com/example/helloendpoints/Greetings.java). |
| 45 | + |
| 46 | + - You can read more about different user authentication supported [here][12]. |
| 47 | + |
| 48 | + |
| 49 | +1. [Optional]: Use Cloud Endpoints Frameworks v2.0 Maven and Gradle discovery and |
| 50 | + client library generation plugins with Cloud Endpoints Frameworks v1.0. |
| 51 | + |
| 52 | + - Uncomment `Endpoints Frameworks v1.0` sections and comment |
| 53 | + `Endpoints Frameworks v2.0` sections in the following files. |
| 54 | + |
| 55 | + ``` |
| 56 | + pom.xml |
| 57 | + build.gradle |
| 58 | + src/main/webapp/WEB-INF/web.xml |
| 59 | + ``` |
| 60 | +
|
| 61 | +## Build and Deployment |
| 62 | +
|
| 63 | +### Maven |
| 64 | +
|
| 65 | +1. Build a fresh binary with |
| 66 | +
|
| 67 | + `mvn clean compile` |
| 68 | +
|
| 69 | +1. Run the application locally at [localhost:8080][5] with |
| 70 | +
|
| 71 | + `mvn appengine:run` |
| 72 | +
|
| 73 | +1. Generate the client library in a zip file named `helloworld-v1-java.zip` with |
| 74 | +
|
| 75 | + `mvn endpoints-framework:clientLibs` |
| 76 | +
|
| 77 | +1. Deploy your application to Google App Engine with |
| 78 | +
|
| 79 | + `mvn appengine:deploy` |
| 80 | +
|
| 81 | +### Gradle |
| 82 | +
|
| 83 | +1. Build a fresh binary with |
| 84 | +
|
| 85 | + `gradle clean compileJava` |
| 86 | +
|
| 87 | +1. Run the application locally at [localhost:8080][5] with |
| 88 | +
|
| 89 | + `gradle appengineRun` |
| 90 | +
|
| 91 | +1. Generate the client library in a zip file named `helloworld-v1-java.zip` with |
| 92 | +
|
| 93 | + `gradle endpointsClientLibs` |
| 94 | +
|
| 95 | +1. Deploy your application to Google App Engine with |
| 96 | +
|
| 97 | + `gradle appengineDeploy` |
| 98 | +
|
| 99 | +[1]: https://cloud.google.com/appengine/docs/java/ |
| 100 | +[2]: http://java.com/en/ |
| 101 | +[3]: https://cloud.google.com/appengine/docs/java/endpoints/ |
| 102 | +[4]: https://cloud.google.com/appengine/docs/java/tools/maven |
| 103 | +[5]: https://localhost:8080/ |
| 104 | +[6]: https://console.developers.google.com/project/_/apiui/credential |
| 105 | +[7]: https://cloud.google.com/appengine/docs/java/endpoints/migrating |
| 106 | +[8]: https://cloud.google.com/endpoints/docs/frameworks/java/about-cloud-endpoints-frameworks |
| 107 | +[9]: https://cloud.google.com/endpoints/docs/frameworks/java/quickstart-frameworks-java |
| 108 | +[10]: https://github.com/GoogleCloudPlatform/endpoints-framework-maven-plugin |
| 109 | +[11]: https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin |
| 110 | +[12]: https://cloud.google.com/endpoints/docs/authenticating-users-frameworks |
0 commit comments