diff --git a/.kokoro/appengine/node10/mongodb.cfg b/.kokoro/appengine/node10/mongodb.cfg deleted file mode 100644 index 10399fe5f3..0000000000 --- a/.kokoro/appengine/node10/mongodb.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Set the folder in which the tests are run -env_vars: { - key: "PROJECT" - value: "appengine/mongodb" -} - -# Tell the trampoline which build file to use. -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-docs-samples/.kokoro/build.sh" -} diff --git a/.kokoro/appengine/node8/mongodb.cfg b/.kokoro/appengine/node8/mongodb.cfg deleted file mode 100644 index 10399fe5f3..0000000000 --- a/.kokoro/appengine/node8/mongodb.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Set the folder in which the tests are run -env_vars: { - key: "PROJECT" - value: "appengine/mongodb" -} - -# Tell the trampoline which build file to use. -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-docs-samples/.kokoro/build.sh" -} diff --git a/appengine/mongodb/.gitignore b/appengine/mongodb/.gitignore deleted file mode 100644 index 34afe36bca..0000000000 --- a/appengine/mongodb/.gitignore +++ /dev/null @@ -1 +0,0 @@ -keys.json diff --git a/appengine/mongodb/README.md b/appengine/mongodb/README.md deleted file mode 100644 index 367d93c0d0..0000000000 --- a/appengine/mongodb/README.md +++ /dev/null @@ -1,18 +0,0 @@ -## MongoDB on Google App Engine - -> [MongoDB][1] is an open source (AGPL licensed), NoSQL document database. - -Refer to the [appengine/README.md](../README.md) file for more instructions on -running and deploying this app. - -[App Engine Node.js flexible environment][2] users may also read the community -tutorial [Connect to MongoDB from Node.js on App Engine flexible environment -][3] for how to run and deploy this -sample app. - -For more information about MongoDB Node.js Driver, read the [node_mongodb documentation][4]. - -[1]: http://mongodb.org/ -[2]: https://cloud.google.com/appengine/docs/flexible/nodejs -[3]: https://cloud.google.com/community/tutorials/nodejs-mongodb-on-appengine -[4]: http://mongodb.github.io/node-mongodb-native/ diff --git a/appengine/mongodb/app.flexible.yaml b/appengine/mongodb/app.flexible.yaml deleted file mode 100644 index 41e9fef5d7..0000000000 --- a/appengine/mongodb/app.flexible.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2015-2016, 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. - -runtime: nodejs -env: flex diff --git a/appengine/mongodb/app.standard.yaml b/appengine/mongodb/app.standard.yaml deleted file mode 100644 index 91eeb4be88..0000000000 --- a/appengine/mongodb/app.standard.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2015-2016, 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. - -runtime: nodejs10 diff --git a/appengine/mongodb/package.json b/appengine/mongodb/package.json deleted file mode 100644 index fa3fb7302f..0000000000 --- a/appengine/mongodb/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "appengine-mongodb", - "description": "An example of using MongoDB with Node.js on Google App Engine.", - "version": "0.0.1", - "private": true, - "license": "Apache Version 2.0", - "author": "Google Inc.", - "engines": { - "node": ">=8" - }, - "scripts": { - "start": "node server.js", - "test": "repo-tools test app -- server.js" - }, - "cloud-repo-tools": { - "test": { - "app": { - "requiredEnvVars": [ - "mongoHost", - "mongoPort", - "mongoUser", - "mongoPassword" - ], - "msg": "IPs:\n::1;", - "args": [ - "server.js" - ] - } - } - }, - "dependencies": { - "mongodb": "^3.1.13", - "nconf": "^0.10.0" - }, - "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^3.0.0" - } -} diff --git a/appengine/mongodb/server.js b/appengine/mongodb/server.js deleted file mode 100644 index 7e18e8a7e6..0000000000 --- a/appengine/mongodb/server.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright 2016, 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 mongodb = require('mongodb'); -const http = require('http'); -const nconf = require('nconf'); - -// Read in keys and secrets. You can store these in -// a keys.json file, or in environment variables -nconf - .argv() - .env() - .file('keys.json'); - -// Connect to a MongoDB server provisioned over at -// MongoLab. See the README for more info. - -const user = nconf.get('mongoUser'); -const pass = nconf.get('mongoPass'); -const host = nconf.get('mongoHost'); -const port = nconf.get('mongoPort'); - -let uri = `mongodb://${user}:${pass}@${host}:${port}`; -if (nconf.get('mongoDatabase')) { - uri = `${uri}/${nconf.get('mongoDatabase')}`; -} - -mongodb.MongoClient.connect(uri, (err, client) => { - if (err) { - throw err; - } - - // Create a simple little server. - http - .createServer((req, res) => { - if (req.url === '/_ah/health') { - res.writeHead(200, { - 'Content-Type': 'text/plain', - }); - res.write('OK'); - res.end(); - return; - } - // Track every IP that has visited this site - const db = client.db(nconf.get('mongoDatabase')); - const collection = db.collection('IPs'); - - const ip = { - address: req.connection.remoteAddress, - }; - - collection.insert(ip, err => { - if (err) { - throw err; - } - - // push out a range - let iplist = ''; - collection.find().toArray((err, data) => { - if (err) { - throw err; - } - data.forEach(ip => { - iplist += `${ip.address}; `; - }); - - res.writeHead(200, { - 'Content-Type': 'text/plain', - }); - res.write('IPs:\n'); - res.end(iplist); - }); - }); - }) - .listen(process.env.PORT || 8080, () => { - console.log('started web process'); - }); -});