-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup App Engine samples and re-work tests. (#354)
- Loading branch information
Showing
478 changed files
with
146,202 additions
and
47,238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,214 +1,91 @@ | ||
# Google App Engine Node.js Samples | ||
|
||
These are samples for using Node.js on Google App Engine Flexible Environment. These | ||
samples are referenced from the [docs](https://cloud.google.com/appengine/docs). | ||
These are samples for using [Node.js][nodejs] on | ||
[Google App Engine Flexible Environment][appengine]. Many of these samples | ||
are referenced from the documentation on [cloud.google.com][appengine]. | ||
|
||
See our other [Google Cloud Platform github repos](https://github.com/GoogleCloudPlatform) | ||
for sample applications and scaffolding for other frameworks and use cases. | ||
There are also samples [submitted by the community][community_samples]. | ||
|
||
## Run Locally | ||
See our other [Google Cloud Platform GitHub repositories](/GoogleCloudPlatform) | ||
for sample applications and scaffolding for other frameworks and use cases. | ||
|
||
Some samples have specific instructions. If there is a README in the sample | ||
folder, please refer to it for any additional steps required to run the sample. | ||
* [Run Locally](#run-locally) | ||
* [Deploying](#deploying) | ||
* [Official samples](#official-samples) | ||
* [Community samples](#community-samples) | ||
|
||
In general, the samples typically require: | ||
## Run Locally | ||
|
||
1. Install the [Google Cloud SDK](https://cloud.google.com/sdk/), including the | ||
[gcloud tool](https://cloud.google.com/sdk/gcloud/), and | ||
[gcloud app component](https://cloud.google.com/sdk/gcloud-app). | ||
1. Setup the gcloud tool. This provides authentication to Google Cloud APIs and | ||
services. | ||
Some samples have specific instructions. If there is a `README.md` file in the | ||
sample folder, please refer to it for any additional steps required to run the | ||
sample. | ||
|
||
gcloud init | ||
The App Engine Node.js samples typically that you do the following: | ||
|
||
1. Acquire local credentials for autheticating with Google Cloud Platform APIs: | ||
1. [Setup your environment for Node.js developement][nodejs_dev]. | ||
1. [Install the Google Cloud SDK][sdk]. | ||
1. Acquire local credentials for authenticating with Google Cloud Platform APIs: | ||
|
||
gcloud beta auth application-default login | ||
gcloud auth application-default login | ||
|
||
1. Clone this repo: | ||
1. Clone this repo: | ||
|
||
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git | ||
|
||
1. Open a sample folder: | ||
1. Choose a sample: | ||
|
||
cd <sample-folder>/ | ||
cd appengine/sample-folder/ | ||
|
||
1. Install depedencies using `npm` or `yarn`: | ||
1. Install depedencies using `npm` or `yarn`: | ||
|
||
npm install | ||
|
||
or | ||
|
||
yarn install | ||
|
||
1. Run the sample with `npm` or `yarn`: | ||
1. Run the sample with `npm` or `yarn` (See the sample's `README.md` file for | ||
any additional setup): | ||
|
||
npm start | ||
|
||
or | ||
|
||
yarn start | ||
|
||
1. Visit the application at [http://localhost:8080](http://localhost:8080). | ||
1. Visit the application at [http://localhost:8080][]. | ||
|
||
## Deploying | ||
|
||
Some samples in this repositories may have special deployment instructions. | ||
Refer to the README file in the sample folder. | ||
|
||
1. Use the [Google Developers Console](https://console.developer.google.com) to | ||
create a project/app id. (App id and project id are identical.) | ||
1. Setup the gcloud tool, if you haven't already. | ||
Refer to the `README.md` file in the sample folder. | ||
|
||
gcloud init | ||
1. Use the [Google Cloud Console][console] to create a Google Cloud Platform | ||
project. | ||
1. [Enable billing][billing] for your project. | ||
|
||
1. Use gcloud to deploy your app. | ||
1. Use the Cloud SDK to deploy your app. | ||
|
||
gcloud app deploy | ||
|
||
Note: If there is a `yarn.lock` file then `yarn install` will be used during | ||
deployment. Delete the `yarn.lock` file to fall back to `npm install`. | ||
|
||
1. Awesome! Your application is now live at `https://YOUR_PROJECT_ID.appspot.com`. | ||
|
||
## Samples | ||
|
||
__Google (Cloud) Products__ | ||
|
||
- Google Analytics - [Source code][aeanalytics_1] | ||
- Google Cloud Logging - [Source code][aelogging_1] | ||
- Google Cloud Pub/Sub - [Source code][aepubsub_1] | ||
- Google Cloud Storage - [Source code][aestorage_1] | ||
|
||
__Frameworks__ | ||
|
||
- Express.js - [Source code][express_1] | [App Engine Tutorial][express_2] | [Live demo][express_3] | [Documentation][express_4] | ||
- Express.js + Memcached Sessions - [Source code][express_5] | [Documentation][express_6] | ||
- Geddy.js - [Source code][geddy_1] | [App Engine Tutorial][geddy_2] | [Live demo][geddy_3] | [Documentation][geddy_4] | ||
- Hapi.js - [Source code][hapi_1] | [App Engine Tutorial][hapi_2] | [Live demo][hapi_3] | [Documentation][hapi_4] | ||
- Loopback.js - [Source code][loopback_1] | [App Engine Tutorial][loopback_2] | [Live demo][loopback_3] | [Documentation][loopback_4] | ||
- Koa.js - [Source code][koa_1] | [App Engine Tutorial][koa_2] | [Live demo][koa_3] | [Documentation][koa_4] | ||
- Kraken.js - [Source code][kraken_1] | [App Engine Tutorial][kraken_2] | [Live demo][kraken_3] | [Documentation][kraken_4] | ||
- Parse-server - [Source code][parse_1] | ||
- Restify.js - [Source code][restify_1] | [App Engine Tutorial][restify_2] | [Live demo][restify_3] | [Documentation][restify_4] | ||
- Sails.js - [Source code][sails_1] | [App Engine Tutorial][sails_2] | [Live demo][sails_3] | [Documentation][sails_4] | ||
|
||
__Databases__ | ||
|
||
- Google Cloud Datastore - [Source code][aedatastore_1] | ||
- Google Cloud SQL - [Source code][aecloudsql_1] | ||
- Memcached - [Source code][memcached_1] | ||
- MongoDB - [Source code][mongodb_1] | [App Engine Tutorial][mongodb_2] | [Documentation][mongodb_3] | ||
- Redis - [Source code][redis_1] | [App Engine Tutorial][redis_2] | [Documentation][redis_3] | ||
|
||
__Tools__ | ||
|
||
- gcloud-node - [Source code][gcloud_1] | [Documentation][gcloud_2] | ||
- Bower - [Source code][bower_1] | [App Engine Tutorial][bower_2] | [Documentation][bower_3] | ||
- Grunt - [Source code][grunt_1] | [App Engine Tutorial][grunt_2] | [Live demo][grunt_3] | [Documentation][grunt_4] | ||
- Mailgun - [Source code][mailgun_1] | [App Engine Tutorial][mailgun_2] | [Documentation][mailgun_3] | ||
- Sendgrid - [Source code][sendgrid_1] | [App Engine Tutorial][sendgrid_2] | [Documentation][sendgrid_3] | ||
- Twilio - [Source code][twilio_1] | ||
- Webpack - [Source code][webpack_1] | [App Engine Tutorial][webpack_2] | [Documentation][webpack_3] | ||
- WebSockets - [Source code][websockets_1] | ||
|
||
__Other Examples__ | ||
|
||
- Express.js Hello World - [Source code][expresshw_1] | ||
- Extending the runtime - [Source code][aeextending_1] | ||
- Reading/writing from/to disk - [Source code][aedisk_1] | ||
- Serving static files - [Source code][aestaticfiles_1] | ||
|
||
[aeanalytics_1]: analytics | ||
[aelogging_1]: logging | ||
[aepubsub_1]: pubsub | ||
[aestorage_1]: storage | ||
|
||
[express_1]: express | ||
[express_2]: https://cloud.google.com/nodejs/resources/frameworks/express | ||
[express_3]: http://express-dot-nodejs-docs-samples.appspot.com | ||
[express_4]: http://expressjs.com/ | ||
[express_5]: express-memcached-session | ||
[express_6]: https://github.com/balor/connect-memcached | ||
|
||
[geddy_1]: geddy | ||
[geddy_2]: https://cloud.google.com/nodejs/resources/frameworks/geddy | ||
[geddy_3]: http://geddy-dot-nodejs-docs-samples.appspot.com | ||
[geddy_4]: http://geddyjs.org/ | ||
|
||
[hapi_1]: hapi | ||
[hapi_2]: https://cloud.google.com/nodejs/resources/frameworks/hapi | ||
[hapi_3]: http://hapi-dot-nodejs-docs-samples.appspot.com | ||
[hapi_4]: http://hapijs.com/ | ||
|
||
[loopback_1]: loopback | ||
[loopback_2]: https://cloud.google.com/nodejs/resources/frameworks/loopback | ||
[loopback_3]: http://loopback-dot-nodejs-docs-samples.appspot.com | ||
[loopback_4]: http://loopback.io/ | ||
|
||
[koa_1]: koa | ||
[koa_2]: https://cloud.google.com/nodejs/resources/frameworks/koa | ||
[koa_3]: http://koa-dot-nodejs-docs-samples.appspot.com | ||
[koa_4]: http://koajs.com/ | ||
|
||
[kraken_1]: kraken | ||
[kraken_2]: https://cloud.google.com/nodejs/resources/frameworks/kraken | ||
[kraken_3]: http://kraken-dot-nodejs-docs-samples.appspot.com | ||
[kraken_4]: http://krakenjs.com/ | ||
|
||
[parse_1]: parse-server | ||
|
||
[restify_1]: restify | ||
[restify_2]: https://cloud.google.com/nodejs/resources/frameworks/restify | ||
[restify_3]: http://restify-dot-nodejs-docs-samples.appspot.com | ||
[restify_4]: http://restify.com/ | ||
|
||
[sails_1]: sails | ||
[sails_2]: https://cloud.google.com/nodejs/resources/frameworks/sails | ||
[sails_3]: http://sails-dot-nodejs-docs-samples.appspot.com | ||
[sails_4]: http://sailsjs.org/ | ||
|
||
[aedatastore_1]: datastore | ||
[aecloudsql_1]: cloudsql | ||
[memcached_1]: memcached | ||
|
||
[mongodb_1]: mongodb | ||
[mongodb_2]: https://cloud.google.com/nodejs/resources/databases/mongodb | ||
[mongodb_3]: https://docs.mongodb.org/ | ||
|
||
[redis_1]: redis | ||
[redis_2]: https://cloud.google.com/nodejs/resources/databases/redis | ||
[redis_3]: https://redis.io/ | ||
|
||
[gcloud_1]: https://github.com/GoogleCloudPlatform/gcloud-node | ||
[gcloud_2]: https://googlecloudplatform.github.io/gcloud-node/#/ | ||
|
||
[bower_1]: bower | ||
[bower_2]: https://cloud.google.com/nodejs/resources/tools/bower | ||
[bower_3]: http://bower.io/ | ||
|
||
[grunt_1]: grunt | ||
[grunt_2]: https://cloud.google.com/nodejs/resources/tools/grunt | ||
[grunt_3]: http://grunt-dot-nodejs-docs-samples.appspot.com | ||
[grunt_4]: http://gruntjs.com/ | ||
|
||
[mailgun_1]: mailgun | ||
[mailgun_2]: https://cloud.google.com/nodejs/resources/tools/mailgun | ||
[mailgun_3]: http://www.mailgun.com/ | ||
|
||
[sendgrid_1]: sendgrid | ||
[sendgrid_2]: https://cloud.google.com/nodejs/resources/tools/sendgrid | ||
[sendgrid_3]: http://sendgrid.com/ | ||
|
||
[twilio_1]: twilio | ||
|
||
[webpack_1]: webpack | ||
[webpack_2]: https://cloud.google.com/nodejs/resources/tools/webpack | ||
[webpack_3]: https://webpack.github.io/ | ||
|
||
[websockets_1]: websockets | ||
|
||
[expresshw_1]: hello-world | ||
[aedisk_1]: disk | ||
[aeextending_1]: extending-runtime | ||
[aestaticfiles_1]: static-files | ||
1. View your deployed application at `https://YOUR_PROJECT_ID.appspot.com`. | ||
|
||
## Official samples | ||
|
||
View the [Official App Engine Node.js samples][official_samples]. | ||
|
||
## Community samples | ||
|
||
View the [Community-contributed App Engine Node.js samples][community_samples]. | ||
|
||
[nodejs]: https://nodejs.org/ | ||
[appengine]: https://cloud.google.com/appengine/docs/flexible/nodejs/ | ||
[nodejs_dev]: https://cloud.google.com/community/tutorials/how-to-prepare-a-nodejs-dev-environment | ||
[sdk]: https://cloud.google.com/sdk/ | ||
[console]: https://console.cloud.google.com | ||
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing | ||
[official_samples]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/appengine | ||
[community_samples]: https://cloud.google.com/community/tutorials/?q=%22Node.js%22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,58 @@ | ||
# Google Analytics Measurement Protocol on Google App Engine | ||
# Integrating with Google Analytics | ||
|
||
This sample demonstrates how to use the [Google Analytics Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/) | ||
(or any other SQL server) on [Google App Engine Flexible Environment](https://cloud.google.com/appengine). | ||
This is the sample application for the | ||
[Integrating with Google Analytics tutorial][tutorial] tutorial found in the | ||
[Google App Engine Node.js Flexible Environment][appengine] documentation. | ||
|
||
* [Setup](#setup) | ||
* [Running locally](#running-locally) | ||
* [Deploying to App Engine](#deploying-to-app-engine) | ||
* [Running the tests](#running-the-tests) | ||
|
||
## Setup | ||
|
||
Before you can run or deploy the sample, you need to do the following: | ||
|
||
1. Create a Google Analytics Property and obtain the Tracking ID. | ||
1. Update the environment variables in in `app.yaml` with your Tracking ID. | ||
1. Refer to the [appengine/README.md][readme] file for instructions on | ||
running and deploying. | ||
1. [Create a Google Analytics Property and obtain the Tracking ID][tracking]. | ||
1. Add your tracking ID to `app.yaml`. | ||
1. Install dependencies: | ||
|
||
With `npm`: | ||
|
||
npm install | ||
|
||
or with `yarn`: | ||
|
||
yarn install | ||
|
||
## Running locally | ||
|
||
Refer to the [appengine/README.md](../README.md) file for instructions on | ||
running and deploying. | ||
With `npm`: | ||
|
||
GA_TRACKING_ID=YOUR_TRACKING_ID npm start | ||
|
||
or with `yarn`: | ||
|
||
GA_TRACKING_ID=YOUR_TRACKING_ID yarn start | ||
|
||
## Deploying to App Engine | ||
|
||
With `npm`: | ||
|
||
npm run deploy | ||
|
||
or with `yarn`: | ||
|
||
yarn run deploy | ||
|
||
## Running the tests | ||
|
||
To run locally, set the environment variables via your shell before running the | ||
sample: | ||
See [Contributing][contributing]. | ||
|
||
export GA_TRACKING_ID=<your-tracking-id> | ||
npm install | ||
npm start | ||
[appengine]: https://cloud.google.com/appengine/docs/flexible/nodejs | ||
[tutorial]: https://cloud.google.com/appengine/docs/flexible/nodejs/integrating-with-analytics | ||
[readme]: ../README.md | ||
[tracking]: https://support.google.com/analytics/answer/1042508 | ||
[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md |
Oops, something went wrong.