|
1 |
| -# StackDriver Debugger sample for Node.js |
| 1 | +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." |
| 2 | +[//]: # "To regenerate it, use `python -m synthtool`." |
| 3 | +<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 | 4 |
|
3 |
| -This sample demonstrates [StackDriver Debugger][debugger] with Node.js. |
| 5 | +# [Stackdriver Debugger: Node.js Samples](https://github.com/googleapis/cloud-debug-nodejs) |
4 | 6 |
|
5 |
| -* [Setup](#setup) |
6 |
| -* [Running locally](#running-locally) |
7 |
| -* [Deploying to App Engine](#deploying-to-app-engine) |
8 |
| -* [Running the tests](#running-the-tests) |
| 7 | +[![Open in Cloud Shell][shell_img]][shell_link] |
9 | 8 |
|
10 |
| -## Setup |
11 | 9 |
|
12 |
| -Before you can run or deploy the sample, you need to do the following (where |
13 |
| -appropriate, replace `YOUR_PROJECT_ID` with the ID of your Cloud project): |
14 | 10 |
|
15 |
| -1. Refer to the `@google-cloud/debug-agent` [README][readme] for instructions on |
16 |
| - running and deploying. |
| 11 | +## Table of Contents |
17 | 12 |
|
18 |
| -1. Set the `GCLOUD_PROJECT` environment variable: |
| 13 | +* [Before you begin](#before-you-begin) |
| 14 | +* [Samples](#samples) |
| 15 | + * [App](#app) |
| 16 | + * [Snippets](#snippets) |
19 | 17 |
|
20 |
| - Linux: |
| 18 | +## Before you begin |
21 | 19 |
|
22 |
| - export GCLOUD_PROJECT=your-project-id |
| 20 | +Before running the samples, make sure you've followed the steps outlined in |
| 21 | +[Using the client library](https://github.com/googleapis/cloud-debug-nodejs#using-the-client-library). |
23 | 22 |
|
24 |
| - Windows: |
| 23 | +## Samples |
25 | 24 |
|
26 |
| - set GCLOUD_PROJECT=your-project-id |
27 | 25 |
|
28 |
| - Windows (PowerShell): |
29 | 26 |
|
30 |
| - $env:GCLOUD_PROJECT="your-project-id" |
| 27 | +### App |
31 | 28 |
|
32 |
| -1. Acquire local credentials for authenticating with Google Cloud Platform APIs: |
| 29 | +View the [source code](https://github.com/googleapis/cloud-debug-nodejs/blob/master/samples/app.js). |
33 | 30 |
|
34 |
| - gcloud auth application-default login |
| 31 | +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/cloud-debug-nodejs&page=editor&open_in_editor=samples/app.js,samples/README.md) |
35 | 32 |
|
36 |
| -1. Configure git to use gcloud SDK: |
| 33 | +__Usage:__ |
37 | 34 |
|
38 |
| - git config credential.helper gcloud.sh |
39 | 35 |
|
40 |
| -1. Add your Cloud Source Repository as a git remote: |
| 36 | +`node app.js` |
41 | 37 |
|
42 |
| - git remote add google https://source.developers.google.com/p/YOUR_PROJECT_ID/r/default |
43 | 38 |
|
44 |
| -1. Commit and push the code into the Cloud Source Repository: |
| 39 | +----- |
45 | 40 |
|
46 |
| - git add -A && git commit -m "Initial commit" && git push --all google |
47 | 41 |
|
48 |
| -1. Install dependencies: |
49 | 42 |
|
50 |
| - npm install |
51 | 43 |
|
52 |
| -## Running locally |
| 44 | +### Snippets |
53 | 45 |
|
54 |
| - npm start |
| 46 | +View the [source code](https://github.com/googleapis/cloud-debug-nodejs/blob/master/samples/snippets.js). |
55 | 47 |
|
| 48 | +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/cloud-debug-nodejs&page=editor&open_in_editor=samples/snippets.js,samples/README.md) |
56 | 49 |
|
57 |
| -## Deploying to App Engine |
| 50 | +__Usage:__ |
58 | 51 |
|
59 |
| - npm run deploy |
60 | 52 |
|
| 53 | +`node snippets.js` |
61 | 54 |
|
62 |
| -Use the [Stackdriver Debugger dashboard](https://console.cloud.google.com/debug) to inspect runtime data of the app. |
63 | 55 |
|
64 |
| -## Running the tests |
65 | 56 |
|
66 |
| -See [Contributing][contributing]. |
67 | 57 |
|
68 |
| -[debugger]: https://cloud.google.com/debugger/ |
69 |
| -[readme]: ../README.md |
70 |
| -[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md |
| 58 | + |
| 59 | + |
| 60 | +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png |
| 61 | +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/cloud-debug-nodejs&page=editor&open_in_editor=samples/README.md |
| 62 | +[product-docs]: https://cloud.google.com/debugger |
0 commit comments