forked from GoogleCloudPlatform/nodejs-docs-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix system tests failing on Jenkins * Add ava * Add Ava WIP * Update google-cloud datastore npm dependency * More AVA WIP * Add nyc for code coverage * Install yarn-breaking packages via npm instead * Try disabling Yarn, since it's failing on Travis * Revert "Try disabling Yarn, since it's failing on Travis" This reverts commit 430f73e6e6d58630244fee58ef8fc812b53e0fc3. * TODO REVERT Switch to debug fork of nodejs-repo-tools * More travis debugging * Finish upgrades (GoogleCloudPlatform#99) * Done with steps 1-3 * Finish upgrades. * Update dependencies * Remove config.json from 7-gce * Fix lint * Update package.json * Add missing return statement * Update dependencies
- Loading branch information
Showing
218 changed files
with
8,134 additions
and
7,209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ test/encrypted/nodejs-docs-samples.json | |
*.iml | ||
.idea/ | ||
key.json | ||
*/yarn.lock | ||
*/yarn.lock | ||
.nyc_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
{ | ||
"name": "nodejs-getting-started", | ||
"version": "1.0.0", | ||
"description": "End to end sample for running Node.JS applications on Google Cloud Platform", | ||
"description": "End to end sample for running Node.js applications on Google Cloud Platform", | ||
"repository": "https://github.com/GoogleCloudPlatform/nodejs-getting-started", | ||
"private": true, | ||
"scripts": { | ||
"start": "node app.js", | ||
"monitor": "nodemon app.js", | ||
"deploy": "gcloud app deploy app.yaml", | ||
"test": "mocha test/index.js -t 30000" | ||
"test": "ava -t 30s test/*.test.js | tap-dot", | ||
"cover": "nyc --cache npm test; nyc report --reporter=html" | ||
}, | ||
"author": "Google Inc.", | ||
"contributors": [ | ||
|
@@ -23,9 +22,13 @@ | |
{ | ||
"name": "Jason Dobry", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Ace Nassri", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"license": "Apache Version 2.0", | ||
"license": "Apache-2.0", | ||
"semistandard": { | ||
"globals": [ | ||
"after", | ||
|
@@ -37,12 +40,13 @@ | |
] | ||
}, | ||
"dependencies": { | ||
"express": "^4.14.0" | ||
"express": "~4.15.2" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^3.0.2", | ||
"ava": "~0.19.1", | ||
"nodejs-repo-tools": "git+https://[email protected]/GoogleCloudPlatform/nodejs-repo-tools.git", | ||
"supertest": "^2.0.0" | ||
"supertest": "~3.0.0", | ||
"tap-dot": "~1.0.5" | ||
}, | ||
"engines": { | ||
"node": ">=4.3.2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,94 @@ tutorial. Please refer to the tutorial for instructions on configuring, running, | |
and deploying this sample. | ||
|
||
[step-2]: https://cloud.google.com/nodejs/getting-started/using-structured-data | ||
|
||
# Simple instructions | ||
|
||
1. Install [Node.js](https://nodejs.org/en/). | ||
|
||
* Optional: Install [Yarn](https://yarnpkg.com/). | ||
|
||
1. Install [git](https://git-scm.com/). | ||
1. Create a [Google Cloud Platform project](https://console.cloud.google.com). | ||
1. Install the [Google Cloud SDK](https://cloud.google.com/sdk/). | ||
|
||
* After downloading the SDK, initialize it: | ||
|
||
gcloud init | ||
|
||
1. Acquire local credentials for authenticating with Google Cloud Platform | ||
services: | ||
|
||
gcloud beta auth application-default login | ||
|
||
1. Clone the repository: | ||
|
||
git clone https://github.com/GoogleCloudPlatform/nodejs-getting-started.git | ||
|
||
1. Change directory: | ||
|
||
cd nodejs-getting-started/2-structured-data | ||
|
||
1. Create a `config.json` file (copied from the `config-default.json` file): | ||
|
||
cp config-default.json config.json | ||
|
||
* Set `GCLOUD_PROJECT` in `config.json` to your Google Cloud Platform | ||
project ID. | ||
* Set `DATA_BACKEND` in `config.json` to one of `"datastore"`, `"cloudsql"`, | ||
or `"mongodb"`. | ||
|
||
1. Install dependencies using NPM or Yarn: | ||
|
||
* Using NPM: | ||
|
||
npm install | ||
|
||
* Using Yarn: | ||
|
||
yarn install | ||
|
||
1. Configure the backing store: | ||
|
||
* If `DATA_BACKEND` is set to `"cloudsql"`: | ||
|
||
1. Create a Cloud SQL instance, and download and start the Cloud SQL | ||
proxy: | ||
|
||
Instructions for doing so: https://cloud.google.com/nodejs/getting-started/using-cloud-sql#creating_a_cloud_sql_instance | ||
1. Set `MYSQL_USER` in `config.json`, e.g. `"my-cloudsql-username"`. | ||
1. Set `MYSQL_PASSWORD` in `config.json`, e.g. `"my-cloudsql-password"`. | ||
1. Set `INSTANCE_CONNECTION_NAME` in `config.json`, e.g. `"YOUR_PROJECT_ID:YOUR_REGION:YOUR_INSTANCE_ID"`. | ||
1. Run the script to setup the table: | ||
|
||
* Using NPM: | ||
|
||
npm run init-cloudsql | ||
|
||
* Using Yarn: | ||
|
||
yarn run init-cloudsql | ||
|
||
* If `DATA_BACKEND` is set to `"mongodb"`: | ||
|
||
1. Set `MONGO_URL` in `config.json`, e.g. `"mongodb://username:[email protected]:27017"`. | ||
|
||
1. Start the app using NPM or Yarn: | ||
|
||
* Using NPM: | ||
|
||
npm start | ||
|
||
* Using Yarn: | ||
|
||
yarn start | ||
|
||
1. View the app at [http://localhost:8080](http://localhost:8080). | ||
|
||
1. Stop the app by pressing `Ctrl+C`. | ||
|
||
1. Deploy the app: | ||
|
||
gcloud app deploy | ||
|
||
1. View the deployed app at [https://YOUR_PROJECT_ID.appspot.com](https://YOUR_PROJECT_ID.appspot.com). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.