-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge samples for Flex and Std #590
Changes from 3 commits
e42d222
63f087d
ebccfbb
905d597
79fca64
c0de187
787fd0b
63377bc
2fd9d85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2017, Google, Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# [START app_yaml] | ||
runtime: nodejs8 | ||
|
||
# [START env] | ||
env_variables: | ||
GA_TRACKING_ID: YOUR_TRACKING_ID | ||
# [END env] | ||
# [END app_yaml] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "appengine-analytics", | ||
"description": "Sample for Google Analytics Measurement Protocol on Google App Engine Flexible Environment.", | ||
"description": "Sample for Google Analytics Measurement Protocol on Google App Engine.", | ||
"version": "0.0.1", | ||
"private": true, | ||
"license": "Apache-2.0", | ||
|
@@ -10,16 +10,14 @@ | |
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jmdobry @lukesneeringer Which versions of Node do we support? AFAIK, this is too restrictive (at least for Flex). @michaelawyu if you make any changes as a result of this comment, please apply those changes to any other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Node 4+, until April 30 when Node 4 reaches end of life and we can switch our samples to support Node 6+ |
||
"node": "8.x.x" | ||
}, | ||
"scripts": { | ||
"deploy": "gcloud app deploy", | ||
"start": "node app.js", | ||
"lint": "repo-tools lint", | ||
"pretest": "npm run lint", | ||
"system-test": "repo-tools test app", | ||
"test": "npm run system-test", | ||
"e2e-test": "repo-tools test deploy" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this removed? (Perhaps because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it's removed because |
||
"test": "npm run system-test" | ||
}, | ||
"dependencies": { | ||
"express": "4.16.2", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Writing Your Web Service Sample for Node.js in the App Engine Standard Environment | ||
|
||
This is the sample application for the | ||
[Writing Your Web Service with Node.js][tutorial] | ||
tutorial found in the [Google App Engine Node.js Standard Environment][appengine] | ||
documentation. | ||
|
||
* [Setup](#setup) | ||
* [Running locally](#running-locally) | ||
* [Deploying to App Engine](#deploying-to-app-engine) | ||
* [Running the tests](#running-the-tests) | ||
|
||
## Setup | ||
|
||
Before you can run or deploy the sample, you need to do the following: | ||
|
||
1. Refer to the [appengine/README.md][readme] file for instructions on | ||
running and deploying. | ||
1. Install dependencies: | ||
|
||
npm install | ||
|
||
## Running locally | ||
|
||
npm start | ||
|
||
## Deploying to App Engine | ||
|
||
npm run deploy | ||
|
||
## Running the tests | ||
|
||
See [Contributing][contributing]. | ||
|
||
[appengine]: https://cloud.google.com/appengine/docs/standard/nodejs | ||
[tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/building-app/writing-web-service | ||
[readme]: ../../README.md | ||
[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2018, Google, Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# [START app_yaml] | ||
runtime: nodejs8 | ||
# [END app_yaml] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "appengine-standard-getting-started-build-apps", | ||
"version": "0.0.1", | ||
"description": "Node.js getting started sample for building an app on App Engine standard environment.", | ||
"private": true, | ||
"main": "server.js", | ||
"scripts": { | ||
"lint": "samples lint", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done :) |
||
"pretest": "npm run lint", | ||
"test": "ava --verbose test/*.test.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" | ||
}, | ||
"engines": { | ||
"node": "8.x.x" | ||
}, | ||
"author": "Google Inc.", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"express": "^4.16.3" | ||
}, | ||
"devDependencies": { | ||
"@google-cloud/nodejs-repo-tools": "1.4.17", | ||
"ava": "0.22.0", | ||
"semistandard": "^12.0.1" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright 2018, Google, Inc. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// [START app] | ||
const express = require('express'); | ||
const app = express(); | ||
|
||
app.get('/', (req, res) => { | ||
res.send('Hello from App Engine!'); | ||
}); | ||
|
||
// Listen to the App Engine-specified port, or 8080 otherwise | ||
const PORT = process.env.PORT || 8080; | ||
app.listen(PORT, () => { | ||
console.log(`Server listening on port ${PORT}...`); | ||
}); | ||
// [END app] | ||
|
||
module.exports = app; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2018, Google, Inc. | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
const path = require(`path`); | ||
const test = require(`ava`); | ||
const utils = require(`@google-cloud/nodejs-repo-tools`); | ||
|
||
const cwd = path.join(__dirname, `../`); | ||
const requestObj = utils.getRequest({ | ||
cwd: cwd, | ||
cmd: `server` }); | ||
|
||
test.beforeEach(utils.stubConsole); | ||
test.afterEach.always(utils.restoreConsole); | ||
|
||
test.cb.serial(`should send greetings`, (t) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jmdobry what are your thoughts on using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we can still do the same tests while deleting code, let's do it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tests for building-an-app/build/ are now done by |
||
requestObj | ||
.get(`/`) | ||
.expect(200) | ||
.expect((response) => { | ||
t.is(response.text, `Hello from App Engine!`); | ||
}) | ||
.end(t.end); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Updating Your Web Service Sample for Node.js in the App Engine Standard Environment | ||
|
||
This is the sample application for the | ||
[Updating Your Web Service][tutorial] | ||
tutorial found in the [Google App Engine Node.js Standard Environment][appengine] | ||
documentation. | ||
|
||
* [Setup](#setup) | ||
* [Running locally](#running-locally) | ||
* [Deploying to App Engine](#deploying-to-app-engine) | ||
* [Running the tests](#running-the-tests) | ||
|
||
## Setup | ||
|
||
Before you can run or deploy the sample, you need to do the following: | ||
|
||
1. Refer to the [appengine/README.md][readme] file for instructions on | ||
running and deploying. | ||
1. Install dependencies: | ||
|
||
npm install | ||
|
||
## Running locally | ||
|
||
npm start | ||
|
||
## Deploying to App Engine | ||
|
||
npm run deploy | ||
|
||
## Running the tests | ||
|
||
See [Contributing][contributing]. | ||
|
||
[appengine]: https://cloud.google.com/appengine/docs/standard/nodejs | ||
[tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/building-app/updating-web-service | ||
[readme]: ../../README.md | ||
[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2018, Google, Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# [START app_yaml] | ||
runtime: nodejs8 | ||
# [END app_yaml] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - these indentations are different.