|
1 | 1 | # Google Cloud Platform NodeJS Samples |
2 | 2 |
|
3 | | -This repository holds the samples used in the nodejs documentation on |
4 | | -[cloud.google.com/nodejs](https://cloud.google.com/nodejs). |
| 3 | +This repository holds Node.js samples used throughout [cloud.google.com](). |
5 | 4 |
|
6 | 5 | [](https://travis-ci.org/GoogleCloudPlatform/nodejs-docs-samples) |
7 | 6 |
|
| 7 | +## Table of Contents |
| 8 | + |
| 9 | +* [Google App Engine](#google-app-engine) |
| 10 | +* [Google Cloud Logging](#google-cloud-logging) |
| 11 | +* [Google Cloud Storage](#google-cloud-storage) |
| 12 | +* [Google Prediction API](#google-prediction-api) |
| 13 | +* [Other Example Apps](#other-example-apps) |
| 14 | +* [More Information](#more-information) |
| 15 | +* [Contributing](#contributing) |
| 16 | +* [License](#license) |
| 17 | + |
8 | 18 | ## Google App Engine |
9 | 19 |
|
10 | 20 | This is a collection of samples and instructions to run common nodejs frameworks |
11 | 21 | and applications on [Google App Engine](http://cloud.google.com/nodejs). |
12 | 22 |
|
13 | | -### Frameworks |
| 23 | +__Google (Cloud) Products__ |
| 24 | + |
| 25 | +- Google Analytics - [Source code][aeanalytics_1] |
| 26 | +- Google Cloud Logging - [Source code][aelogging_1] |
| 27 | +- Google Cloud Pub/Sub - [Source code][aepubsub_1] |
| 28 | +- Google Cloud Storage - [Source code][aestorage_1] |
| 29 | + |
| 30 | +__Frameworks__ |
14 | 31 |
|
15 | 32 | - Express.js - [Source code][express_1] | [App Engine Tutorial][express_2] | [Live demo][express_3] | [Documentation][express_4] |
16 | 33 | - Express.js + Memcached Sessions - [Source code][express_5] | [Documentation][express_6] |
@@ -22,25 +39,51 @@ and applications on [Google App Engine](http://cloud.google.com/nodejs). |
22 | 39 | - Restify.js - [Source code][restify_1] | [App Engine Tutorial][restify_2] | [Live demo][restify_3] | [Documentation][restify_4] |
23 | 40 | - Sails.js - [Source code][sails_1] | [App Engine Tutorial][sails_2] | [Live demo][sails_3] | [Documentation][sails_4] |
24 | 41 |
|
25 | | -### Databases |
| 42 | +__Databases__ |
26 | 43 |
|
| 44 | +- Google Cloud Datastore - [Source code][aedatastore_1] |
| 45 | +- Google Cloud SQL - [Source code][aecloudsql_1] |
| 46 | +- Memcached - [Source code][memcached_1] |
27 | 47 | - MongoDB - [Source code][mongodb_1] | [App Engine Tutorial][mongodb_2] | [Documentation][mongodb_3] |
28 | 48 | - Redis - [Source code][redis_1] | [App Engine Tutorial][redis_2] | [Documentation][redis_3] |
29 | 49 |
|
30 | | -### Tools |
| 50 | +__Tools__ |
31 | 51 |
|
32 | 52 | - gcloud-node - [Source code][gcloud_1] | [Documentation][gcloud_2] |
33 | 53 | - Bower - [Source code][bower_1] | [App Engine Tutorial][bower_2] | [Documentation][bower_3] |
34 | 54 | - Grunt - [Source code][grunt_1] | [App Engine Tutorial][grunt_2] | [Live demo][grunt_3] | [Documentation][grunt_4] |
35 | 55 | - Mailgun - [Source code][mailgun_1] | [App Engine Tutorial][mailgun_2] | [Documentation][mailgun_3] |
36 | 56 | - Sendgrid - [Source code][sendgrid_1] | [App Engine Tutorial][sendgrid_2] | [Documentation][sendgrid_3] |
| 57 | +- Twilio - [Source code][twilio_1] |
37 | 58 | - Webpack - [Source code][webpack_1] | [App Engine Tutorial][webpack_2] | [Documentation][webpack_3] |
| 59 | +- WebSockets - [Source code][websockets_1] |
| 60 | + |
| 61 | +__Other Examples__ |
| 62 | + |
| 63 | +- Express.js Hello World - [Source code][expresshw_1] |
| 64 | +- Extending the runtime - [Source code][aeextending_1] |
| 65 | +- Reading/writing from/to disk - [Source code][aedisk_1] |
| 66 | +- Serving static files - [Source code][aestaticfiles_1] |
| 67 | + |
| 68 | +## Google Cloud Datastore |
| 69 | + |
| 70 | +- Tasks sample - [Source code][datastore_1] | [Documentation][datastore_2] |
| 71 | + |
| 72 | +## Google Cloud Logging |
| 73 | + |
| 74 | +- Reading logs sample - [Source code][logging_read_1] | [Documentation][logging_read_2] |
| 75 | +- Writing logs sample - [Source code][logging_write_1] | [Documentation][logging_write_2] |
| 76 | +- Exporting logs sample - [Source code][logging_export_1] | [Documentation][logging_export_2] |
| 77 | + |
| 78 | +## Google Cloud Storage |
| 79 | + |
| 80 | +- Auth sample - [Source code][storage_1] | [Documentation][storage_2] |
38 | 81 |
|
39 | | -## Google Storage |
| 82 | +## Google Prediction API |
40 | 83 |
|
41 | | -- Auth sample - [Source code][storage_1] | [Google Cloud Docs][storage_2] |
| 84 | +- Hosted Models sample - [Source code][predictionapi_1] | [Documentation][predictionapi_2] |
42 | 85 |
|
43 | | -## Example Apps |
| 86 | +## Other Example Apps |
44 | 87 |
|
45 | 88 | - nodejs-getting-started - [Source code][nodejs_1] | [App Engine Tutorial 1][nodejs_2] | [App Engine Tutorial 2][nodejs_3] |
46 | 89 | - gcloud-node-todos - [Source code][todos_1] |
@@ -54,7 +97,7 @@ and applications on [Google App Engine](http://cloud.google.com/nodejs). |
54 | 97 | - [Using the `gcloud` npm module](https://googlecloudplatform.github.io/gcloud-node/#/) |
55 | 98 | - [Logging to Google Cloud with Winston](https://github.com/GoogleCloudPlatform/winston-gae) |
56 | 99 |
|
57 | | -## Contributing changes |
| 100 | +## Contributing |
58 | 101 |
|
59 | 102 | Contributions welcome! |
60 | 103 |
|
@@ -68,6 +111,9 @@ See [CONTRIBUTING.md](https://github.com/GoogleCloudPlatform/nodejs-docs-samples |
68 | 111 | 1. Start Redis |
69 | 112 | 1. Start Memcached |
70 | 113 | 1. Set the `TEST_PROJECT_ID` environment variable to id of your project |
| 114 | +1. Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path to |
| 115 | +a service account file. You can download one from your Google project's |
| 116 | +"permissions" page. |
71 | 117 | 1. `npm test` |
72 | 118 |
|
73 | 119 | Since the tests use [Mocha.js](https://mochajs.org/), you can use the `--grep` |
@@ -77,42 +123,34 @@ option causes the matched tests to be excluded instead of included. |
77 | 123 | __Run only the tests that match a pattern:__ |
78 | 124 |
|
79 | 125 |
|
80 | | -``` |
81 | | -npm test -- -- --grep <pattern> |
82 | | -``` |
| 126 | + npm test -- -- --grep <pattern> |
83 | 127 |
|
84 | 128 | __Only run the tests for the `datastore` sample:__ |
85 | 129 |
|
86 | | -``` |
87 | | -npm test -- -- --grep datastore |
88 | | -``` |
| 130 | + npm test -- -- --grep datastore |
89 | 131 |
|
90 | 132 | __Skip the tests that match a pattern:__ |
91 | 133 |
|
92 | | -``` |
93 | | -npm test -- -- --grep <pattern> --invert |
94 | | -``` |
| 134 | + npm test -- -- --grep <pattern> --invert |
95 | 135 |
|
96 | 136 | __Run all but the `datastore` tests:__ |
97 | 137 |
|
98 | | -``` |
99 | | -npm test -- -- --grep datastore --invert |
100 | | -``` |
| 138 | + npm test -- -- --grep datastore --invert |
101 | 139 |
|
102 | 140 | __Skip the tests that require Redis and Memcached:__ |
103 | 141 |
|
104 | | -``` |
105 | | -npm test -- -- --grep "express-memcached-session|redis" --invert |
106 | | -``` |
| 142 | + npm test -- -- --grep "express-memcached-session|redis" --invert |
107 | 143 |
|
108 | | -## Licensing |
| 144 | +## License |
109 | 145 |
|
110 | 146 | Apache Version 2.0 |
111 | 147 |
|
112 | 148 | See [LICENSE](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/LICENSE) |
113 | 149 |
|
114 | | -[storage_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/storage/authSample.js |
115 | | -[storage_2]: https://cloud.google.com/storage/docs/authentication#acd-examples |
| 150 | +[aeanalytics_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/analytics |
| 151 | +[aelogging_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/logging |
| 152 | +[aepubsub_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/pubsub |
| 153 | +[aestorage_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/storage |
116 | 154 |
|
117 | 155 | [express_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/express |
118 | 156 | [express_2]: https://cloud.google.com/nodejs/resources/frameworks/express |
@@ -156,6 +194,10 @@ See [LICENSE](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/ma |
156 | 194 | [sails_3]: http://sails-dot-nodejs-docs-samples.appspot.com |
157 | 195 | [sails_4]: http://sailsjs.org/ |
158 | 196 |
|
| 197 | +[aedatastore_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/datastore |
| 198 | +[aecloudsql_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/cloudsql |
| 199 | +[memcached_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/memcached |
| 200 | + |
159 | 201 | [mongodb_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/mongodb |
160 | 202 | [mongodb_2]: https://cloud.google.com/nodejs/resources/databases/mongo |
161 | 203 | [mongodb_3]: https://docs.mongodb.org/ |
@@ -184,10 +226,35 @@ See [LICENSE](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/ma |
184 | 226 | [sendgrid_2]: https://cloud.google.com/nodejs/resources/tools/sendgrid |
185 | 227 | [sendgrid_3]: http://sendgrid.com/ |
186 | 228 |
|
| 229 | +[twilio_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/twilio |
| 230 | + |
187 | 231 | [webpack_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/webpack |
188 | 232 | [webpack_2]: https://cloud.google.com/nodejs/resources/tools/webpack |
189 | 233 | [webpack_3]: https://webpack.github.io/ |
190 | 234 |
|
| 235 | +[websockets_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/websockets |
| 236 | + |
| 237 | +[expresshw_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/hello-world |
| 238 | +[aedisk_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/disk |
| 239 | +[aeextending_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/extending-runtime |
| 240 | +[aestaticfiles_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/appengine/static-files |
| 241 | + |
| 242 | +[datastore_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/datastore/tasks.js |
| 243 | +[datastore_2]: https://cloud-dot-devsite.googleplex.com/datastore/docs/concepts/overview |
| 244 | + |
| 245 | +[logging_read_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/logging/list.js |
| 246 | +[logging_read_2]: https://cloud-dot-devsite.googleplex.com/logging/docs/api/tasks/authorization |
| 247 | +[logging_write_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/logging/write.js |
| 248 | +[logging_write_2]: https://cloud.google.com/logging/docs/api/tasks/creating-logs |
| 249 | +[logging_export_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/logging/export.js |
| 250 | +[logging_export_2]: https://cloud.google.com/logging/docs/api/tasks/exporting-logs |
| 251 | + |
| 252 | +[storage_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/storage/authSample.js |
| 253 | +[storage_2]: https://cloud.google.com/storage/docs/authentication#acd-examples |
| 254 | + |
| 255 | +[predictionapi_1]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/prediction/hostedmodels.js |
| 256 | +[predictionapi_2]: https://cloud.google.com/prediction/docs/developer-guide#predictionfromappengine |
| 257 | + |
191 | 258 | [nodejs_1]: https://github.com/GoogleCloudPlatform/nodejs-getting-started |
192 | 259 | [nodejs_2]: https://cloud.google.com/nodejs/getting-started/hello-world |
193 | 260 | [nodejs_3]: https://cloud.google.com/nodejs/getting-started/tutorial-app |
|