|
| 1 | +<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/> |
| 2 | + |
| 3 | +# Google Cloud Datastore Node.js Samples |
| 4 | + |
| 5 | +[]() |
| 6 | + |
| 7 | +[Cloud Datastore](https://cloud.google.com/datastore/docs) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. While the Cloud Datastore interface has many of the same features as traditional databases, as a NoSQL database it differs from them in the way it describes relationships between data objects. |
| 8 | + |
| 9 | +## Table of Contents |
| 10 | + |
| 11 | +* [Setup](#setup) |
| 12 | +* [Samples](#samples) |
| 13 | + * [Tasks](#tasks) |
| 14 | + * [Concepts](#concepts) |
| 15 | + * [Errors and Error Handling](#errors-and-error-handling) |
| 16 | +* [Running the tests](#running-the-tests) |
| 17 | + |
| 18 | +## Setup |
| 19 | + |
| 20 | +1. Read [Prerequisites][prereq] and [How to run a sample][run] first. |
| 21 | +1. Install dependencies: |
| 22 | + |
| 23 | + With **npm**: |
| 24 | + |
| 25 | + npm install |
| 26 | + |
| 27 | + With **yarn**: |
| 28 | + |
| 29 | + yarn install |
| 30 | + |
| 31 | +[prereq]: ../README.md#prerequisites |
| 32 | +[run]: ../README.md#how-to-run-a-sample |
| 33 | + |
| 34 | +## Samples |
| 35 | + |
| 36 | +### Tasks |
| 37 | + |
| 38 | +View the [documentation][tasks_0_docs] or the [source code][tasks_0_code]. |
| 39 | + |
| 40 | +__Usage:__ `node tasks.js --help` |
| 41 | + |
| 42 | +``` |
| 43 | +Commands: |
| 44 | + new <description> Adds a task with a description <description>. |
| 45 | + done <taskId> Marks the specified task as done. |
| 46 | + list Lists all tasks ordered by creation time. |
| 47 | + delete <taskId> Deletes a task. |
| 48 | +
|
| 49 | +Options: |
| 50 | + --version Show version number [boolean] |
| 51 | + --help Show help [boolean] |
| 52 | +
|
| 53 | +Examples: |
| 54 | + node tasks.js new "Buy milk" Adds a task with description "Buy milk". |
| 55 | + node tasks.js done 12345 Marks task 12345 as Done. |
| 56 | + node tasks.js list Lists all tasks ordered by creation time |
| 57 | + node tasks.js delete 12345 Deletes task 12345. |
| 58 | +
|
| 59 | +For more information, see https://cloud.google.com/datastore/docs |
| 60 | +``` |
| 61 | + |
| 62 | +[tasks_0_docs]: https://cloud.google.com/datastore/docs/datastore-api-tutorial |
| 63 | +[tasks_0_code]: tasks.js |
| 64 | + |
| 65 | +### Concepts |
| 66 | + |
| 67 | +View the [documentation][concepts_1_docs] or the [source code][concepts_1_code].[concepts_1_docs]: https://cloud.google.com/datastore/docs/concepts/entities |
| 68 | +[concepts_1_code]: concepts.js |
| 69 | + |
| 70 | +### Errors and Error Handling |
| 71 | + |
| 72 | +View the [documentation][error_2_docs] or the [source code][error_2_code]. |
| 73 | + |
| 74 | +__Usage:__ `node error.js` |
| 75 | +[error_2_docs]: https://cloud.google.com/datastore/docs/concepts/errors |
| 76 | +[error_2_code]: error.js |
| 77 | + |
| 78 | +## Running the tests |
| 79 | + |
| 80 | +1. Set the **GCLOUD_PROJECT** and **GOOGLE_APPLICATION_CREDENTIALS** environment variables. |
| 81 | + |
| 82 | +1. Run the tests: |
| 83 | + |
| 84 | + With **npm**: |
| 85 | + |
| 86 | + npm test |
| 87 | + |
| 88 | + With **yarn**: |
| 89 | + |
| 90 | + yarn test |
0 commit comments