Skip to content

Commit ce94259

Browse files
jmdobryAce Nassri
authored and
Ace Nassri
committed
Cleanup App Engine samples and re-work tests. (#354)
1 parent c4c676c commit ce94259

File tree

478 files changed

+146202
-47238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

478 files changed

+146202
-47238
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ var program = module.exports = {
176176
<METHOD_NAME>: <METHOD_NAME>,
177177
main: function (args) {
178178
// Run the command-line program
179-
cli.help().strict().parse(args).argv;
179+
cli.help().strict().parse(args).argv; // eslint-disable-line
180180
}
181181
};
182182

appengine/README.md

+49-172
Original file line numberDiff line numberDiff line change
@@ -1,214 +1,91 @@
11
# Google App Engine Node.js Samples
22

3-
These are samples for using Node.js on Google App Engine Flexible Environment. These
4-
samples are referenced from the [docs](https://cloud.google.com/appengine/docs).
3+
These are samples for using [Node.js][nodejs] on
4+
[Google App Engine Flexible Environment][appengine]. Many of these samples
5+
are referenced from the documentation on [cloud.google.com][appengine].
56

6-
See our other [Google Cloud Platform github repos](https://github.com/GoogleCloudPlatform)
7-
for sample applications and scaffolding for other frameworks and use cases.
7+
There are also samples [submitted by the community][community_samples].
88

9-
## Run Locally
9+
See our other [Google Cloud Platform GitHub repositories](/GoogleCloudPlatform)
10+
for sample applications and scaffolding for other frameworks and use cases.
1011

11-
Some samples have specific instructions. If there is a README in the sample
12-
folder, please refer to it for any additional steps required to run the sample.
12+
* [Run Locally](#run-locally)
13+
* [Deploying](#deploying)
14+
* [Official samples](#official-samples)
15+
* [Community samples](#community-samples)
1316

14-
In general, the samples typically require:
17+
## Run Locally
1518

16-
1. Install the [Google Cloud SDK](https://cloud.google.com/sdk/), including the
17-
[gcloud tool](https://cloud.google.com/sdk/gcloud/), and
18-
[gcloud app component](https://cloud.google.com/sdk/gcloud-app).
19-
1. Setup the gcloud tool. This provides authentication to Google Cloud APIs and
20-
services.
19+
Some samples have specific instructions. If there is a `README.md` file in the
20+
sample folder, please refer to it for any additional steps required to run the
21+
sample.
2122

22-
gcloud init
23+
The App Engine Node.js samples typically that you do the following:
2324

24-
1. Acquire local credentials for autheticating with Google Cloud Platform APIs:
25+
1. [Setup your environment for Node.js developement][nodejs_dev].
26+
1. [Install the Google Cloud SDK][sdk].
27+
1. Acquire local credentials for authenticating with Google Cloud Platform APIs:
2528

26-
gcloud beta auth application-default login
29+
gcloud auth application-default login
2730

28-
1. Clone this repo:
31+
1. Clone this repo:
2932

3033
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git
3134

32-
1. Open a sample folder:
35+
1. Choose a sample:
3336

34-
cd <sample-folder>/
37+
cd appengine/sample-folder/
3538

36-
1. Install depedencies using `npm` or `yarn`:
39+
1. Install depedencies using `npm` or `yarn`:
3740

3841
npm install
3942

4043
or
4144

4245
yarn install
4346

44-
1. Run the sample with `npm` or `yarn`:
47+
1. Run the sample with `npm` or `yarn` (See the sample's `README.md` file for
48+
any additional setup):
4549

4650
npm start
4751

4852
or
4953

5054
yarn start
5155

52-
1. Visit the application at [http://localhost:8080](http://localhost:8080).
56+
1. Visit the application at [http://localhost:8080][].
5357

5458
## Deploying
5559

5660
Some samples in this repositories may have special deployment instructions.
57-
Refer to the README file in the sample folder.
58-
59-
1. Use the [Google Developers Console](https://console.developer.google.com) to
60-
create a project/app id. (App id and project id are identical.)
61-
1. Setup the gcloud tool, if you haven't already.
61+
Refer to the `README.md` file in the sample folder.
6262

63-
gcloud init
63+
1. Use the [Google Cloud Console][console] to create a Google Cloud Platform
64+
project.
65+
1. [Enable billing][billing] for your project.
6466

65-
1. Use gcloud to deploy your app.
67+
1. Use the Cloud SDK to deploy your app.
6668

6769
gcloud app deploy
6870

6971
Note: If there is a `yarn.lock` file then `yarn install` will be used during
7072
deployment. Delete the `yarn.lock` file to fall back to `npm install`.
7173

72-
1. Awesome! Your application is now live at `https://YOUR_PROJECT_ID.appspot.com`.
73-
74-
## Samples
75-
76-
__Google (Cloud) Products__
77-
78-
- Google Analytics - [Source code][aeanalytics_1]
79-
- Google Cloud Logging - [Source code][aelogging_1]
80-
- Google Cloud Pub/Sub - [Source code][aepubsub_1]
81-
- Google Cloud Storage - [Source code][aestorage_1]
82-
83-
__Frameworks__
84-
85-
- Express.js - [Source code][express_1] | [App Engine Tutorial][express_2] | [Live demo][express_3] | [Documentation][express_4]
86-
- Express.js + Memcached Sessions - [Source code][express_5] | [Documentation][express_6]
87-
- Geddy.js - [Source code][geddy_1] | [App Engine Tutorial][geddy_2] | [Live demo][geddy_3] | [Documentation][geddy_4]
88-
- Hapi.js - [Source code][hapi_1] | [App Engine Tutorial][hapi_2] | [Live demo][hapi_3] | [Documentation][hapi_4]
89-
- Loopback.js - [Source code][loopback_1] | [App Engine Tutorial][loopback_2] | [Live demo][loopback_3] | [Documentation][loopback_4]
90-
- Koa.js - [Source code][koa_1] | [App Engine Tutorial][koa_2] | [Live demo][koa_3] | [Documentation][koa_4]
91-
- Kraken.js - [Source code][kraken_1] | [App Engine Tutorial][kraken_2] | [Live demo][kraken_3] | [Documentation][kraken_4]
92-
- Parse-server - [Source code][parse_1]
93-
- Restify.js - [Source code][restify_1] | [App Engine Tutorial][restify_2] | [Live demo][restify_3] | [Documentation][restify_4]
94-
- Sails.js - [Source code][sails_1] | [App Engine Tutorial][sails_2] | [Live demo][sails_3] | [Documentation][sails_4]
95-
96-
__Databases__
97-
98-
- Google Cloud Datastore - [Source code][aedatastore_1]
99-
- Google Cloud SQL - [Source code][aecloudsql_1]
100-
- Memcached - [Source code][memcached_1]
101-
- MongoDB - [Source code][mongodb_1] | [App Engine Tutorial][mongodb_2] | [Documentation][mongodb_3]
102-
- Redis - [Source code][redis_1] | [App Engine Tutorial][redis_2] | [Documentation][redis_3]
103-
104-
__Tools__
105-
106-
- gcloud-node - [Source code][gcloud_1] | [Documentation][gcloud_2]
107-
- Bower - [Source code][bower_1] | [App Engine Tutorial][bower_2] | [Documentation][bower_3]
108-
- Grunt - [Source code][grunt_1] | [App Engine Tutorial][grunt_2] | [Live demo][grunt_3] | [Documentation][grunt_4]
109-
- Mailgun - [Source code][mailgun_1] | [App Engine Tutorial][mailgun_2] | [Documentation][mailgun_3]
110-
- Sendgrid - [Source code][sendgrid_1] | [App Engine Tutorial][sendgrid_2] | [Documentation][sendgrid_3]
111-
- Twilio - [Source code][twilio_1]
112-
- Webpack - [Source code][webpack_1] | [App Engine Tutorial][webpack_2] | [Documentation][webpack_3]
113-
- WebSockets - [Source code][websockets_1]
114-
115-
__Other Examples__
116-
117-
- Express.js Hello World - [Source code][expresshw_1]
118-
- Extending the runtime - [Source code][aeextending_1]
119-
- Reading/writing from/to disk - [Source code][aedisk_1]
120-
- Serving static files - [Source code][aestaticfiles_1]
121-
122-
[aeanalytics_1]: analytics
123-
[aelogging_1]: logging
124-
[aepubsub_1]: pubsub
125-
[aestorage_1]: storage
126-
127-
[express_1]: express
128-
[express_2]: https://cloud.google.com/nodejs/resources/frameworks/express
129-
[express_3]: http://express-dot-nodejs-docs-samples.appspot.com
130-
[express_4]: http://expressjs.com/
131-
[express_5]: express-memcached-session
132-
[express_6]: https://github.com/balor/connect-memcached
133-
134-
[geddy_1]: geddy
135-
[geddy_2]: https://cloud.google.com/nodejs/resources/frameworks/geddy
136-
[geddy_3]: http://geddy-dot-nodejs-docs-samples.appspot.com
137-
[geddy_4]: http://geddyjs.org/
138-
139-
[hapi_1]: hapi
140-
[hapi_2]: https://cloud.google.com/nodejs/resources/frameworks/hapi
141-
[hapi_3]: http://hapi-dot-nodejs-docs-samples.appspot.com
142-
[hapi_4]: http://hapijs.com/
143-
144-
[loopback_1]: loopback
145-
[loopback_2]: https://cloud.google.com/nodejs/resources/frameworks/loopback
146-
[loopback_3]: http://loopback-dot-nodejs-docs-samples.appspot.com
147-
[loopback_4]: http://loopback.io/
148-
149-
[koa_1]: koa
150-
[koa_2]: https://cloud.google.com/nodejs/resources/frameworks/koa
151-
[koa_3]: http://koa-dot-nodejs-docs-samples.appspot.com
152-
[koa_4]: http://koajs.com/
153-
154-
[kraken_1]: kraken
155-
[kraken_2]: https://cloud.google.com/nodejs/resources/frameworks/kraken
156-
[kraken_3]: http://kraken-dot-nodejs-docs-samples.appspot.com
157-
[kraken_4]: http://krakenjs.com/
158-
159-
[parse_1]: parse-server
160-
161-
[restify_1]: restify
162-
[restify_2]: https://cloud.google.com/nodejs/resources/frameworks/restify
163-
[restify_3]: http://restify-dot-nodejs-docs-samples.appspot.com
164-
[restify_4]: http://restify.com/
165-
166-
[sails_1]: sails
167-
[sails_2]: https://cloud.google.com/nodejs/resources/frameworks/sails
168-
[sails_3]: http://sails-dot-nodejs-docs-samples.appspot.com
169-
[sails_4]: http://sailsjs.org/
170-
171-
[aedatastore_1]: datastore
172-
[aecloudsql_1]: cloudsql
173-
[memcached_1]: memcached
174-
175-
[mongodb_1]: mongodb
176-
[mongodb_2]: https://cloud.google.com/nodejs/resources/databases/mongodb
177-
[mongodb_3]: https://docs.mongodb.org/
178-
179-
[redis_1]: redis
180-
[redis_2]: https://cloud.google.com/nodejs/resources/databases/redis
181-
[redis_3]: https://redis.io/
182-
183-
[gcloud_1]: https://github.com/GoogleCloudPlatform/gcloud-node
184-
[gcloud_2]: https://googlecloudplatform.github.io/gcloud-node/#/
185-
186-
[bower_1]: bower
187-
[bower_2]: https://cloud.google.com/nodejs/resources/tools/bower
188-
[bower_3]: http://bower.io/
189-
190-
[grunt_1]: grunt
191-
[grunt_2]: https://cloud.google.com/nodejs/resources/tools/grunt
192-
[grunt_3]: http://grunt-dot-nodejs-docs-samples.appspot.com
193-
[grunt_4]: http://gruntjs.com/
194-
195-
[mailgun_1]: mailgun
196-
[mailgun_2]: https://cloud.google.com/nodejs/resources/tools/mailgun
197-
[mailgun_3]: http://www.mailgun.com/
198-
199-
[sendgrid_1]: sendgrid
200-
[sendgrid_2]: https://cloud.google.com/nodejs/resources/tools/sendgrid
201-
[sendgrid_3]: http://sendgrid.com/
202-
203-
[twilio_1]: twilio
204-
205-
[webpack_1]: webpack
206-
[webpack_2]: https://cloud.google.com/nodejs/resources/tools/webpack
207-
[webpack_3]: https://webpack.github.io/
208-
209-
[websockets_1]: websockets
210-
211-
[expresshw_1]: hello-world
212-
[aedisk_1]: disk
213-
[aeextending_1]: extending-runtime
214-
[aestaticfiles_1]: static-files
74+
1. View your deployed application at `https://YOUR_PROJECT_ID.appspot.com`.
75+
76+
## Official samples
77+
78+
View the [Official App Engine Node.js samples][official_samples].
79+
80+
## Community samples
81+
82+
View the [Community-contributed App Engine Node.js samples][community_samples].
83+
84+
[nodejs]: https://nodejs.org/
85+
[appengine]: https://cloud.google.com/appengine/docs/flexible/nodejs/
86+
[nodejs_dev]: https://cloud.google.com/community/tutorials/how-to-prepare-a-nodejs-dev-environment
87+
[sdk]: https://cloud.google.com/sdk/
88+
[console]: https://console.cloud.google.com
89+
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
90+
[official_samples]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/appengine
91+
[community_samples]: https://cloud.google.com/community/tutorials/?q=%22Node.js%22

appengine/analytics/README.md

+47-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,58 @@
1-
# Google Analytics Measurement Protocol on Google App Engine
1+
# Integrating with Google Analytics
22

3-
This sample demonstrates how to use the [Google Analytics Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/)
4-
(or any other SQL server) on [Google App Engine Flexible Environment](https://cloud.google.com/appengine).
3+
This is the sample application for the
4+
[Integrating with Google Analytics tutorial][tutorial] tutorial found in the
5+
[Google App Engine Node.js Flexible Environment][appengine] documentation.
6+
7+
* [Setup](#setup)
8+
* [Running locally](#running-locally)
9+
* [Deploying to App Engine](#deploying-to-app-engine)
10+
* [Running the tests](#running-the-tests)
511

612
## Setup
713

814
Before you can run or deploy the sample, you need to do the following:
915

10-
1. Create a Google Analytics Property and obtain the Tracking ID.
11-
1. Update the environment variables in in `app.yaml` with your Tracking ID.
16+
1. Refer to the [appengine/README.md][readme] file for instructions on
17+
running and deploying.
18+
1. [Create a Google Analytics Property and obtain the Tracking ID][tracking].
19+
1. Add your tracking ID to `app.yaml`.
20+
1. Install dependencies:
21+
22+
With `npm`:
23+
24+
npm install
25+
26+
or with `yarn`:
27+
28+
yarn install
1229

1330
## Running locally
1431

15-
Refer to the [appengine/README.md](../README.md) file for instructions on
16-
running and deploying.
32+
With `npm`:
33+
34+
GA_TRACKING_ID=YOUR_TRACKING_ID npm start
35+
36+
or with `yarn`:
37+
38+
GA_TRACKING_ID=YOUR_TRACKING_ID yarn start
39+
40+
## Deploying to App Engine
41+
42+
With `npm`:
43+
44+
npm run deploy
45+
46+
or with `yarn`:
47+
48+
yarn run deploy
49+
50+
## Running the tests
1751

18-
To run locally, set the environment variables via your shell before running the
19-
sample:
52+
See [Contributing][contributing].
2053

21-
export GA_TRACKING_ID=<your-tracking-id>
22-
npm install
23-
npm start
54+
[appengine]: https://cloud.google.com/appengine/docs/flexible/nodejs
55+
[tutorial]: https://cloud.google.com/appengine/docs/flexible/nodejs/integrating-with-analytics
56+
[readme]: ../README.md
57+
[tracking]: https://support.google.com/analytics/answer/1042508
58+
[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md

0 commit comments

Comments
 (0)