Skip to content

Commit

Permalink
docs(samples): Update ReadMe and comments for samples (#225)
Browse files Browse the repository at this point in the history
* docs(samples): Update ReadMe and comments for samples

* docs(samples): Update ReadMe and comments for samples

* Update bodyparser and comment

* Fix merge error

* Add comment for bodyParser

* Update comment
  • Loading branch information
averikitsch authored and grayside committed Nov 3, 2022
1 parent 18d5cf8 commit e7939bf
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cloud-tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,4 @@ __Usage:__

[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-tasks&page=editor&open_in_editor=samples/README.md
[product-docs]: https://cloud.google.com/tasks/docs/
[product-docs]: https://cloud.google.com/tasks/docs/
6 changes: 3 additions & 3 deletions cloud-tasks/createHttpTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ async function createHttpTask(

// TODO(developer): Uncomment these lines and replace with your values.
// const project = 'my-project-id';
// const queue = 'my-appengine-queue';
// const queue = 'my-queue';
// const location = 'us-central1';
// const url = 'https://<project-id>.appspot.com/log_payload'
// const options = {payload: 'hello'};
// const url = 'https://example.com/taskhandler'
// const payload = 'hello';

// Construct the fully qualified queue name.
const parent = client.queuePath(project, location, queue);
Expand Down
6 changes: 3 additions & 3 deletions cloud-tasks/createHttpTaskWithToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ async function createHttpTaskWithToken(

// TODO(developer): Uncomment these lines and replace with your values.
// const project = 'my-project-id';
// const queue = 'my-appengine-queue';
// const queue = 'my-queue';
// const location = 'us-central1';
// const url = 'https://<project-id>.appspot.com/log_payload'
// const url = 'https://example.com/taskhandler'
// const email = 'client@<project-id>.iam.gserviceaccount.com'
// const options = {payload: 'hello'};
// const payload = 'hello';

// Construct the fully qualified queue name.
const parent = client.queuePath(project, location, queue);
Expand Down
3 changes: 2 additions & 1 deletion cloud-tasks/createTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ async function createTask(project, location, queue, payload, inSeconds) {
// const project = 'my-project-id';
// const queue = 'my-appengine-queue';
// const location = 'us-central1';
// const options = {payload: 'hello'};
// const payload = 'hello';
// const inSeconds = 30;

// Construct the fully qualified queue name.
const parent = client.queuePath(project, location, queue);
Expand Down
2 changes: 1 addition & 1 deletion cloud-tasks/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function createTask(project, location, queue, payload, inSeconds) {
// const project = 'my-project-id';
// const queue = 'my-appengine-queue';
// const location = 'us-central1';
// const options = {payload: 'hello'};
// const payload = 'hello';

// Construct the fully qualified queue name.
const parent = client.queuePath(project, location, queue);
Expand Down
6 changes: 3 additions & 3 deletions cloud-tasks/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const express = require('express');
const app = express();
app.enable('trust proxy');

app.use(bodyParser.raw());
app.use(bodyParser.json());
app.use(bodyParser.text());
// By default, the Content-Type header of the Task request is set to "application/octet-stream"
// see https://cloud.google.com/tasks/docs/reference/rest/v2beta3/projects.locations.queues.tasks#AppEngineHttpRequest
app.use(bodyParser.raw({type: 'application/octet-stream'}));

app.get('/', (req, res) => {
// Basic index to verify app is serving
Expand Down

0 comments on commit e7939bf

Please sign in to comment.