diff --git a/.gitignore b/.gitignore index 1ca957177f..c24a7afcc7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -node_modules/ +**/node_modules/** npm-debug.log diff --git a/appengine/express/README.md b/appengine/express/README.md index 46f9dc53da..af04714045 100644 --- a/appengine/express/README.md +++ b/appengine/express/README.md @@ -1,25 +1,32 @@ -# Express -> Google App Engine +## Express on Google App Engine -This is a simple guide to running [expressjs](http://expressjs.com/) on Google App Engine. +> [Express](http://expressjs.com) is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. -1. [Create a new Express app](http://expressjs.com/starter/generator.html) +##### Create a new Express app -2. Create an `app.yaml` in the root of your application with the following contents: +View the [Express app generator guide](http://expressjs.com/starter/generator.html). + +##### Configure + +Create an `app.yaml` in the root of your application with the following contents: ```yaml runtime: nodejs vm: true +api_version: 1 env_variables: PORT: 8080 ``` -3. Deploy your app. For convenience, you can use an npm script to run the command. Modify your `package.json` to include: +##### Deploy + +For convenience, you can use an npm script to run the deploy command. Modify your `package.json` to include: -```js +```json "scripts": { "start": "node ./bin/www", "deploy": "gcloud preview app deploy app.yaml --set-default --project [project id]" } ``` -At the terminal you can now run `npm run deploy` to deploy your application. +At the terminal you can now run `npm run deploy` to deploy your application. \ No newline at end of file diff --git a/appengine/express/app.yaml b/appengine/express/app.yaml index 00668a6347..6f48107af0 100644 --- a/appengine/express/app.yaml +++ b/appengine/express/app.yaml @@ -12,7 +12,7 @@ # limitations under the License. runtime: nodejs -api_version: 1 vm: true +api_version: 1 env_variables: PORT: 8080 \ No newline at end of file diff --git a/appengine/express/bin/www b/appengine/express/bin/www index 29bd16240e..7aec6f629d 100755 --- a/appengine/express/bin/www +++ b/appengine/express/bin/www @@ -14,7 +14,7 @@ var http = require('http'); * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || '3000'); +var port = normalizePort(process.env.PORT || 8080); app.set('port', port); /** diff --git a/appengine/express/package.json b/appengine/express/package.json index 806153c5f9..71a2a85fed 100644 --- a/appengine/express/package.json +++ b/appengine/express/package.json @@ -2,17 +2,18 @@ "name": "express", "version": "0.0.0", "private": true, + "license": "Apache Version 2.0", "scripts": { "start": "node ./bin/www", "deploy": "gcloud preview app deploy app.yaml --set-default --project express-demo" }, "dependencies": { - "body-parser": "~1.12.4", - "cookie-parser": "~1.3.5", - "debug": "~2.2.0", - "express": "~4.12.4", - "jade": "~1.9.2", - "morgan": "~1.5.3", - "serve-favicon": "~2.2.1" + "body-parser": "^1.14.1", + "cookie-parser": "^1.4.0", + "debug": "^2.2.0", + "express": "^4.13.3", + "jade": "^1.11.0", + "morgan": "^1.6.1", + "serve-favicon": "^2.3.0" } } \ No newline at end of file diff --git a/appengine/express/routes/index.js b/appengine/express/routes/index.js index 7b8cb0b8e6..6839bf7897 100644 --- a/appengine/express/routes/index.js +++ b/appengine/express/routes/index.js @@ -18,7 +18,7 @@ var router = express.Router(); /* GET home page. */ router.get('/', function(req, res) { - res.render('index', { title: 'Express |2|' }); + res.render('index', { title: 'Express 4 on Google App Engine' }); }); module.exports = router; diff --git a/appengine/geddy/README.md b/appengine/geddy/README.md index c3d4cb1774..b3bfffd0b2 100644 --- a/appengine/geddy/README.md +++ b/appengine/geddy/README.md @@ -1,10 +1,14 @@ -# Geddy -> Google App Engine +## Geddy on Google App Engine -This is a simple guide to running [geddy](http://geddyjs.org/) on Google App Engine. +> [Geddy](http://geddyjs.org/) is a simple, structured web framework for Node. -1. [Create a new geddy app](http://geddyjs.org/tutorial). +##### Create a new Geddy app -2. Create an `app.yaml` in the root of your application with the following contents: +[View the Geddy tutorial](http://geddyjs.org/tutorial). + +##### Configure + +Create an `app.yaml` in the root of your application with the following contents: ```yaml runtime: nodejs @@ -14,24 +18,28 @@ env_variables: PORT: 8080 ``` -3. Create a `server.js` that contains the following code: +##### Prepare the app + +Create a `server.js` that contains the following code: ```js var geddy = require('geddy'); geddy.start({ - port: process.env.PORT || '3000' + port: process.env.PORT || 8080 }); ``` -4. Run `npm install --save geddy` +Run `npm install --save geddy` -5. Deploy! For convenience, you can modify your `package.json` to use an npm script for deployment: +##### Deploy -```js +For convenience, you can use an npm script to run the deploy command. Modify your `package.json` to include: + +```json "scripts": { "deploy": "gcloud preview app deploy app.yaml --set-default --project [project id]" } ``` -At the terminal you can now run `npm run deploy` to deploy your application. +At the terminal you can now run `npm run deploy` to deploy your application. \ No newline at end of file diff --git a/appengine/geddy/package.json b/appengine/geddy/package.json index 12a4794948..0173e9daad 100644 --- a/appengine/geddy/package.json +++ b/appengine/geddy/package.json @@ -3,6 +3,7 @@ "description": "An example of running geddy on Google App Engine. ", "author": "", "version": "0.0.1", + "license": "Apache Version 2.0", "dependencies": { "geddy": "^13.0.8" }, diff --git a/appengine/geddy/server.js b/appengine/geddy/server.js index 245265cf1c..0dc356fab3 100644 --- a/appengine/geddy/server.js +++ b/appengine/geddy/server.js @@ -16,5 +16,5 @@ var geddy = require('geddy'); geddy.start({ - port: process.env.PORT || '3000' + port: process.env.PORT || 8080 }); \ No newline at end of file diff --git a/appengine/grunt/.gitignore b/appengine/grunt/.gitignore new file mode 100644 index 0000000000..4bc00c21b2 --- /dev/null +++ b/appengine/grunt/.gitignore @@ -0,0 +1 @@ +rc/public/stylesheets/style.min.css \ No newline at end of file diff --git a/appengine/grunt/README.md b/appengine/grunt/README.md index 65ddd13f81..38396c2b12 100644 --- a/appengine/grunt/README.md +++ b/appengine/grunt/README.md @@ -1,10 +1,14 @@ -# Grunt -> Google App Engine +## Grunt on Google App Engine -This is a simple guide to using [grunt](http://gruntjs.com/) with Google App Engine. +> [Grunt](http://gruntjs.com/): The JavaScript Task Runner. -1. Follow the [grunt getting started guide](http://gruntjs.com/getting-started) to get up and runnning. +##### Create a new app -2. Create an `app.yaml` in the root of your application with the following contents: +[View the Grunt docs](http://gruntjs.com/getting-started). + +##### Configure + +Create an `app.yaml` in the root of your application with the following contents: ```yaml runtime: nodejs @@ -14,17 +18,21 @@ env_variables: PORT: 8080 ``` -3. Run `npm install --save-dev grunt-cli` to make the Grunt command line tools available locally during the build. +Run `npm install --save-dev grunt-cli` to make the Grunt command line tools available locally during the build. + +##### Deploy + +Modify your `package.json` to include an npm `postinstall` script. This will be run during your applications `npm install` phase. -4. Modify your `package.json` to include an npm `postinstall` script. This will be run during your applications `npm install` phase. For convenience, you can use an npm script to deploy as well: +For convenience, you can use an npm script to run the deploy command. Modify your `package.json` to include: -```js +```json "scripts": { "start": "node ./src/bin/www", "postinstall": "./node_modules/grunt-cli/bin/grunt build", "deploy": "gcloud preview app deploy app.yaml --set-default --project gruntjs-demo", "browse": "open http://gruntjs-demo.appspot.com" -}, +} ``` -At the terminal you can now run `npm run deploy` to deploy your application. +At the terminal you can now run `npm run deploy` to deploy your application. diff --git a/appengine/grunt/package.json b/appengine/grunt/package.json index d4a8acf998..f4e1924b79 100644 --- a/appengine/grunt/package.json +++ b/appengine/grunt/package.json @@ -2,6 +2,7 @@ "name": "appengine-grunt", "version": "0.0.0", "private": true, + "license": "Apache Version 2.0", "scripts": { "start": "node ./src/bin/www", "postinstall": "./node_modules/grunt-cli/bin/grunt build", @@ -9,19 +10,19 @@ "browse": "open http://gruntjs-demo.appspot.com" }, "dependencies": { - "body-parser": "~1.12.4", - "cookie-parser": "~1.3.5", - "debug": "~2.2.0", - "express": "~4.12.4", - "jade": "~1.9.2", - "morgan": "~1.5.3", - "serve-favicon": "~2.2.1" + "body-parser": "^1.14.1", + "cookie-parser": "^1.4.0", + "debug": "^2.2.0", + "express": "^4.13.3", + "jade": "^1.11.0", + "morgan": "^1.6.1", + "serve-favicon": "^2.3.0" }, "devDependencies": { "grunt": "^0.4.5", "grunt-cli": "^0.1.13", "grunt-contrib-clean": "^0.6.0", - "grunt-contrib-cssmin": "^0.13.0", + "grunt-contrib-cssmin": "^0.14.0", "grunt-contrib-jshint": "^0.11.2", "grunt-contrib-watch": "^0.6.1" } diff --git a/appengine/grunt/src/bin/www b/appengine/grunt/src/bin/www index f1c284b47d..18b0a968ef 100755 --- a/appengine/grunt/src/bin/www +++ b/appengine/grunt/src/bin/www @@ -12,7 +12,7 @@ var http = require('http'); * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || '3000'); +var port = normalizePort(process.env.PORT || 8080); app.set('port', port); /** diff --git a/appengine/grunt/src/routes/index.js b/appengine/grunt/src/routes/index.js index 094a6163ae..6551843133 100644 --- a/appengine/grunt/src/routes/index.js +++ b/appengine/grunt/src/routes/index.js @@ -18,7 +18,7 @@ var router = express.Router(); /* GET home page. */ router.get('/', function(req, res, next) { - res.render('index', { title: 'Express' }); + res.render('index', { title: 'Grunt + Express 4 on Google App Engine' }); }); module.exports = router; diff --git a/appengine/hapi/README.md b/appengine/hapi/README.md index a2c1a81c2d..2af8f61964 100644 --- a/appengine/hapi/README.md +++ b/appengine/hapi/README.md @@ -1,41 +1,51 @@ -# Hapi -> Google App Engine +## Hapi on Google App Engine -This is a simple guide to running [hapijs](http://hapijs.com/) on Google App Engine. +> [Hapi](http://hapijs.com/) is a rich framework for building applications and services. Hapi enabled developers to focus on writing reusable application logic instead of spending time building infrastructure. -1. [Create a new Hapi app](http://hapijs.com/) +##### Create a new Hapi app -2. Update `package.json` to add an `npm start` command: +[View the Hapi docs](http://hapijs.com/). -```js +##### Configure + +Create an `app.yaml` in the root of your application with the following contents: + +```yaml +runtime: nodejs +vm: true +api_version: 1 +env_variables: + PORT: 8080 +``` + +##### Prepare the app + +Update `package.json` to add an `npm start` command: + +```json "scripts": { "start": "node index.js", -}, +} ``` -3. Update the port in `index.js` to use `process.env.PORT || 8080`, and `0.0.0.0`: +Update the port in `index.js` to use `process.env.PORT || 8080`, and `0.0.0.0`: ```js -server.connection({ - host: '0.0.0.0', +server.connection({ + host: '0.0.0.0', port: process.env.PORT || 8080 }); ``` -4. Create an `app.yaml` in the root of your application with the following contents: +##### Deploy -```yaml -runtime: nodejs -vm: true -api_version: 1 -``` +For convenience, you can use an npm script to run the deploy command. Modify your `package.json` to include: -5. Deploy your app. For convenience, you can use an npm script to run the command. Modify your `package.json` to include: - -```js +```json "scripts": { "start": "node index.js", "deploy": "gcloud preview app deploy app.yaml --set-default --project [project id]" } ``` -At the terminal you can now run `npm run deploy` to deploy your application. +At the terminal you can now run `npm run deploy` to deploy your application. \ No newline at end of file diff --git a/appengine/hapi/app.yaml b/appengine/hapi/app.yaml index eba137e031..50683850a1 100644 --- a/appengine/hapi/app.yaml +++ b/appengine/hapi/app.yaml @@ -14,3 +14,5 @@ runtime: nodejs vm: true api_version: 1 +env_variables: + PORT: 8080 diff --git a/appengine/hapi/index.js b/appengine/hapi/index.js index a2e623db6d..ae0031d8ab 100644 --- a/appengine/hapi/index.js +++ b/appengine/hapi/index.js @@ -18,18 +18,29 @@ var Hapi = require('hapi'); // Create a server with a host and port var server = new Hapi.Server(); server.connection({ - host: '127.0.0.1', - port: process.env.PORT || 8080 + host: '127.0.0.1', + port: process.env.PORT || 8080 }); -// Add the route +// Add an index route server.route({ - method: 'GET', - path:'/hello', - handler: function (request, reply) { - reply('hello world'); - } + method: 'GET', + path:'/', + handler: function (request, reply) { + reply('hello world'); + } +}); + +// Add another route +server.route({ + method: 'GET', + path:'/hello', + handler: function (request, reply) { + reply('hello world'); + } }); // Start the server -server.start(); \ No newline at end of file +server.start(function () { + console.log('Server running at:', server.info.uri); +}); \ No newline at end of file diff --git a/appengine/hapi/package.json b/appengine/hapi/package.json index 88e6f637b6..ccc36fa61a 100644 --- a/appengine/hapi/package.json +++ b/appengine/hapi/package.json @@ -14,8 +14,8 @@ "hapi" ], "author": "Justin Beckwith", - "license": "MIT", + "license": "Apache Version 2.0", "dependencies": { - "hapi": "^8.8.1" + "hapi": "^10.1.0" } } diff --git a/appengine/koa/README.md b/appengine/koa/README.md index 01b445b5a6..6f1e576478 100644 --- a/appengine/koa/README.md +++ b/appengine/koa/README.md @@ -1,8 +1,12 @@ -# Koa -> Google App Engine +## Koa on Google App Engine -This is a simple guide to running [koa](http://koajs.com/) on Google App Engine. +> [koa](http://koajs.com) is a next generation web framework for node.js -1. [Create a new Koa app](http://koajs.com/). Start by creating an `app.js`: +##### Create a new Koa app + +[View the Koa docs](http://koajs.com/). + +Start by creating an `app.js`: ```js var koa = require('koa'); @@ -15,7 +19,9 @@ app.use(function *(){ app.listen(process.env.PORT || 8080); ``` -2. Create an `app.yaml` in the root of your application with the following contents: +##### Configure + +Create an `app.yaml` in the root of your application with the following contents: ```yaml runtime: nodejs @@ -25,15 +31,21 @@ env_variables: PORT: 8080 ``` -3. Run `npm init` to initialize a `package.json`. +##### Prepare the app -4. Modify your `package.json`. Add a `start` command - take care to include the `--harmony` flag, as koa requires generators. For convenience, you can use an npm script to run the command: +Run `npm init` to initialize a `package.json`. -```js +Modify your `package.json`. Add a `start` command - take care to include the `--harmony` flag, as koa requires generators. + +##### Deploy + +For convenience, you can use an npm script to run the deploy command. Modify your `package.json` to include: + +```json "scripts": { "start": "node --harmony app.js", "deploy": "gcloud preview app deploy app.yaml --set-default --project [project id]" } ``` -At the terminal you can now run `npm run deploy` to deploy your application. +At the terminal you can now run `npm run deploy` to deploy your application. \ No newline at end of file diff --git a/appengine/koa/package.json b/appengine/koa/package.json index a315066719..ae0b0ee038 100644 --- a/appengine/koa/package.json +++ b/appengine/koa/package.json @@ -4,7 +4,7 @@ "description": "An example of deploying a koa app to Google App Engine", "main": "app.js", "dependencies": { - "koa": "^0.21.0" + "koa": "^1.0.0" }, "devDependencies": {}, "scripts": { @@ -21,7 +21,7 @@ "koa" ], "author": "Justin Beckwith", - "license": "MIT", + "license": "Apache Version 2.0", "bugs": { "url": "https://github.com/JustinBeckwith/appengine-nodejs-samples/issues" }, diff --git a/appengine/kraken/.build/js/app.js b/appengine/kraken/.build/js/app.js index 2af2c3451c..07e6366bb8 100644 --- a/appengine/kraken/.build/js/app.js +++ b/appengine/kraken/.build/js/app.js @@ -1,11 +1,22 @@ -'use strict'; +// Copyright 2015, 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'; requirejs.config({ paths: {} }); - require([/* Dependencies */], function () { var app = { diff --git a/appengine/kraken/README.md b/appengine/kraken/README.md index a2398f3458..749561b555 100644 --- a/appengine/kraken/README.md +++ b/appengine/kraken/README.md @@ -1,10 +1,14 @@ -# Kraken -> Google App Engine +## Kraken on Google App Engine -This is a simple guide to running [krakenjs](http://krakenjs.com/) on Google App Engine. +> [Kraken](http://krakenjs.com) is a secure and scalable layer that extends express by providing structure and convention. -1. [Create a new kraken app](http://krakenjs.com/index.html#getting-started). +##### Create a new Kraken app -2. Create an `app.yaml` in the root of your application with the following contents: +[View the Kraken docs](http://krakenjs.com/index.html#getting-started). + +##### Configure + +Create an `app.yaml` in the root of your application with the following contents: ```yaml runtime: nodejs @@ -12,14 +16,15 @@ vm: true api_version: 1 env_variables: PORT: 8080 -``` -4. Deploy! For convenience, you can modify your `package.json` to use an npm script for deployment: +##### Deploy + +For convenience, you can use an npm script to run the deploy command. Modify your `package.json` to include: -```js +```json "scripts": { "deploy": "gcloud preview app deploy app.yaml --set-default --project [project id]" } ``` -At the terminal you can now run `npm run deploy` to deploy your application. +At the terminal you can now run `npm run deploy` to deploy your application. \ No newline at end of file diff --git a/appengine/kraken/app.yaml b/appengine/kraken/app.yaml index 00668a6347..6f48107af0 100644 --- a/appengine/kraken/app.yaml +++ b/appengine/kraken/app.yaml @@ -12,7 +12,7 @@ # limitations under the License. runtime: nodejs -api_version: 1 vm: true +api_version: 1 env_variables: PORT: 8080 \ No newline at end of file diff --git a/appengine/kraken/index.js b/appengine/kraken/index.js index b548c480b4..dcae7416f5 100644 --- a/appengine/kraken/index.js +++ b/appengine/kraken/index.js @@ -24,18 +24,18 @@ var options, app; * See https://github.com/krakenjs/kraken-js#options for additional configuration options. */ options = { - onconfig: function (config, next) { - /* - * Add any additional config setup or overrides here. `config` is an initialized - * `confit` (https://github.com/krakenjs/confit/) configuration object. - */ - next(null, config); - } + onconfig: function (config, next) { + /* + * Add any additional config setup or overrides here. `config` is an initialized + * `confit` (https://github.com/krakenjs/confit/) configuration object. + */ + next(null, config); + } }; app = module.exports = express(); app.use(kraken(options)); app.on('start', function () { - console.log('Application ready to serve requests.'); - console.log('Environment: %s', app.kraken.get('env:env')); + console.log('Application ready to serve requests.'); + console.log('Environment: %s', app.kraken.get('env:env')); }); diff --git a/appengine/kraken/package.json b/appengine/kraken/package.json index 02c3133c3a..1a3bdd6f9d 100644 --- a/appengine/kraken/package.json +++ b/appengine/kraken/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "description": "An example of running krakenjs on Google App Engine. ", "author": "Justin Beckwith", + "license": "Apache Version 2.0", "main": "index.js", "repository": { "type": "git", @@ -30,14 +31,14 @@ "grunt-cli": "^0.1.13", "grunt-config-dir": "^0.3.2", "grunt-contrib-clean": "^0.6.0", - "grunt-contrib-jshint": "^0.10.0", + "grunt-contrib-jshint": "^0.11.3", "grunt-contrib-less": "^1.0.1", "grunt-contrib-requirejs": "^0.4.4", - "grunt-copy-to": "0.0.10", + "grunt-copy-to": "0.0.12", "grunt-dustjs": "^1.2.1", "grunt-makara-amdify": "^1.0.1", "grunt-mocha-cli": "^1.14.0", - "mocha": "^1.18.0", - "supertest": "^0.9.0" + "mocha": "^2.3.3", + "supertest": "^1.1.0" } } diff --git a/appengine/kraken/server.js b/appengine/kraken/server.js index 4fca8f4a06..0bd1af30b2 100644 --- a/appengine/kraken/server.js +++ b/appengine/kraken/server.js @@ -23,7 +23,7 @@ var server; */ server = http.createServer(app); -server.listen(process.env.PORT || 8000); +server.listen(process.env.PORT || 8080); server.on('listening', function () { - console.log('Server listening on http://localhost:%d', this.address().port); + console.log('Server listening on http://localhost:%d', this.address().port); }); diff --git a/appengine/loopback/README.md b/appengine/loopback/README.md index fdccca90e2..95cb8ae7b6 100644 --- a/appengine/loopback/README.md +++ b/appengine/loopback/README.md @@ -1,10 +1,14 @@ -# Loopback -> Google App Engine +## Loopback on Google App Engine -This is a simple guide to running [loopback](http://loopback.io/) on Google App Engine. +> [Loopback](http://loopback.io/) is a highly-extensible, open-source Node.js framework. -1. [Create a new loopback app](http://loopback.io/getting-started/). +##### Create a new Loopback app -2. Create an `app.yaml` in the root of your application with the following contents: +[View the Loopback docs](http://loopback.io/getting-started/). + +##### Configure + +Create an `app.yaml` in the root of your application with the following contents: ```yaml runtime: nodejs @@ -14,13 +18,15 @@ env_variables: PORT: 8080 ``` -3. Create a `start` deploy script, and deploy! For convenience, you can modify your `package.json` to use an npm script for deployment: +##### Deploy + +For convenience, you can use an npm script to run the deploy command. Modify your `package.json` to include: -```js +```json "scripts": { "start": "node .", "deploy": "gcloud preview app deploy app.yaml --set-default --project [project id]" } ``` -At the terminal you can now run `npm run deploy` to deploy your application. +At the terminal you can now run `npm run deploy` to deploy your application. diff --git a/appengine/loopback/package.json b/appengine/loopback/package.json index c13ed0eb6a..d662e3f000 100644 --- a/appengine/loopback/package.json +++ b/appengine/loopback/package.json @@ -26,5 +26,6 @@ "type": "", "url": "" }, + "license": "Apache Version 2.0", "description": "An example of running loopback on Google App Engine." } diff --git a/appengine/loopback/server/config.json b/appengine/loopback/server/config.json index ac5e58c599..3b1707641b 100644 --- a/appengine/loopback/server/config.json +++ b/appengine/loopback/server/config.json @@ -1,7 +1,7 @@ { "restApiRoot": "/api", "host": "0.0.0.0", - "port": 3000, + "port": 8080, "remoting": { "context": { "enableHttpContext": false diff --git a/appengine/redis/README.md b/appengine/redis/README.md index cfa9905305..91a8ea66fc 100644 --- a/appengine/redis/README.md +++ b/appengine/redis/README.md @@ -1,12 +1,14 @@ -# Redis -> Google App Engine +## Redis on Google App Engine -This is a simple guide building an application on Google App Engine that uses [redis](http://redis.io/). +> [Redis](http://redis.io/) is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker. + +##### Start a Redis server There are multiple options to creating a new redis server: - Create a GCE virtual machine with redis preinstalled - Use [Redis Labs](https://redislabs.com/signup-gce-lp1) to create a free Redis-as-a-Service account -## Sign up for a redis labs account +###### Sign up for a redis labs account To sign up for a new redis labs account: @@ -15,9 +17,11 @@ To sign up for a new redis labs account: 3. Choose the free tier 4. Click `select` 5. Choose a resource name and password -6. Place your host name, port, and key into a json file. Here's an example of the json file I'm using: +6. Place your host name, port, and key into a json file. + +Here's an example json file: -```js +```json { "redisHost": "pub-redis-*****.us-central1-1-1.gce.garantiadata.com", "redisPort": ******, @@ -27,10 +31,9 @@ To sign up for a new redis labs account: Make sure to not check this file into source control by adding `keys.json` to your `.gitignore`. +##### Configure -## Using redis from App Engine - -1. Create an `app.yaml` in the root of your application with the following contents: +Create an `app.yaml` in the root of your application with the following contents: ```yaml runtime: nodejs @@ -40,12 +43,15 @@ env_variables: PORT: 8080 ``` -2. Deploy! For convenience, you can modify your `package.json` to use an npm script for deployment: +##### Deploy + +For convenience, you can use an npm script to run the deploy command. Modify your `package.json` to include: -```js +```json "scripts": { + "start": "node ./bin/www", "deploy": "gcloud preview app deploy app.yaml --set-default --project [project id]" } ``` -At the terminal you can now run `npm run deploy` to deploy your application. +At the terminal you can now run `npm run deploy` to deploy your application. diff --git a/appengine/redis/package.json b/appengine/redis/package.json index 88184417b3..f7f0188b38 100644 --- a/appengine/redis/package.json +++ b/appengine/redis/package.json @@ -17,13 +17,13 @@ "google" ], "author": "Justin Beckwith", - "license": "MIT", + "license": "Apache Version 2.0", "bugs": { "url": "https://github.com/JustinBeckwith/appengine-nodejs-samples/issues" }, "homepage": "https://github.com/JustinBeckwith/appengine-nodejs-samples", "dependencies": { - "nconf": "^0.7.2", - "redis": "^0.12.1" + "nconf": "^0.8.0", + "redis": "^2.0.1" } } diff --git a/appengine/redis/server.js b/appengine/redis/server.js index 6c2d813af8..14f096bf7d 100644 --- a/appengine/redis/server.js +++ b/appengine/redis/server.js @@ -64,6 +64,6 @@ http.createServer(function (req, res) { res.end(iplist); }); -}).listen(process.env.PORT || 3000); +}).listen(process.env.PORT || 8080); console.log('started web process'); \ No newline at end of file diff --git a/appengine/restify/README.md b/appengine/restify/README.md index 704f22e407..90bd384413 100644 --- a/appengine/restify/README.md +++ b/appengine/restify/README.md @@ -1,12 +1,14 @@ -# Restify -> Google App Engine +## Restify on Google App Engine -This is a simple guide to running [restify](http://restify.com/) on Google App Engine. +> [Restify](http://mcavage.me/node-restify/) is a node.js module built specifically to enable you to build correct REST web services. -1. Create a new directory for your code. +##### Create a new Restify app -2. Run `npm init` and follow the prompts. +Create a new directory for your code. -3. Create a `server.js` with the following code: +Run `npm init` and follow the prompts. + +Create a `server.js` with the following code: ```js var restify = require('restify'); @@ -34,9 +36,9 @@ server.listen(process.env.PORT || 8080, function () { }); ``` -4. Run `npm install --save restify` +Run `npm install --save restify` -5. Create an `app.yaml` in the root of your application with the following contents: +##### Configure Create an `app.yaml` in the root of your application with the following contents: ```yaml runtime: nodejs @@ -46,12 +48,14 @@ env_variables: PORT: 8080 ``` -6. Deploy! For convenience, you can modify your `package.json` to use an npm script for deployment: +##### Deploy -```js +For convenience, you can use an npm script to run the deploy command. Modify your `package.json` to include: + +```json "scripts": { "deploy": "gcloud preview app deploy app.yaml --set-default --project [project id]" } ``` -At the terminal you can now run `npm run deploy` to deploy your application. +At the terminal you can now run `npm run deploy` to deploy your application. \ No newline at end of file diff --git a/appengine/restify/package.json b/appengine/restify/package.json index 5fd4cefc66..2b18361dc0 100644 --- a/appengine/restify/package.json +++ b/appengine/restify/package.json @@ -17,7 +17,7 @@ "nodejs" ], "author": "Justin Beckwith", - "license": "MIT", + "license": "Apache Version 2.0", "bugs": { "url": "https://github.com/JustinBeckwith/appengine-nodejs-samples/issues" }, diff --git a/appengine/sails/README.md b/appengine/sails/README.md index 8c6d14292f..f798ce35f4 100644 --- a/appengine/sails/README.md +++ b/appengine/sails/README.md @@ -1,10 +1,14 @@ -# Sails -> Google App Engine +## Sails on Google App Engine -This is a simple guide to running [sails](http://sailsjs.com/) on Google App Engine. +> [Sails](http://sailsjs.org/) makes it easy to build custom, enterprise-grade Node.js apps. -1. [Create a new sailsjs app](http://sailsjs.org/get-started) +##### Create a new Sails app -2. Create an `app.yaml` in the root of your application with the following contents: +[View the Sails docs](http://sailsjs.org/get-started) + +##### Configure + +Create an `app.yaml` in the root of your application with the following contents: ```yaml runtime: nodejs @@ -12,16 +16,17 @@ vm: true api_version: 1 env_variables: PORT: 8080 -``` -3. Deploy your app. For convenience, you can use an npm script to run the command. Modify your `package.json` to include: +##### Deploy + +For convenience, you can use an npm script to run the deploy command. Modify your `package.json` to include: -```js +```json "scripts": { "debug": "node debug app.js", "start": "node app.js", "deploy": "gcloud preview app deploy app.yaml --set-default --project [project id]" -}, +} ``` -At the terminal you can now run `npm run deploy` to deploy your application. +At the terminal you can now run `npm run deploy` to deploy your application. diff --git a/appengine/sails/config/env/development.js b/appengine/sails/config/env/development.js index 3716916268..0c9a1849af 100644 --- a/appengine/sails/config/env/development.js +++ b/appengine/sails/config/env/development.js @@ -21,4 +21,5 @@ module.exports = { // connection: 'someMongodbServer' // } + port: 8080 }; diff --git a/appengine/sails/package.json b/appengine/sails/package.json index 472da476bd..6c5b7fac33 100644 --- a/appengine/sails/package.json +++ b/appengine/sails/package.json @@ -5,23 +5,23 @@ "description": "a Sails application", "keywords": [], "dependencies": { - "ejs": "~0.8.4", - "grunt": "0.4.2", - "grunt-contrib-clean": "~0.5.0", - "grunt-contrib-coffee": "~0.10.1", - "grunt-contrib-concat": "~0.3.0", - "grunt-contrib-copy": "~0.5.0", - "grunt-contrib-cssmin": "~0.9.0", - "grunt-contrib-jst": "~0.6.0", - "grunt-contrib-less": "0.11.1", - "grunt-contrib-uglify": "~0.4.0", - "grunt-contrib-watch": "~0.5.3", - "grunt-sails-linker": "~0.9.5", - "grunt-sync": "~0.0.4", - "include-all": "~0.1.3", - "rc": "~0.5.0", - "sails": "~0.11.0", - "sails-disk": "~0.10.0" + "ejs": "^2.3.4", + "grunt": "0.4.5", + "grunt-contrib-clean": "^0.6.0", + "grunt-contrib-coffee": "^0.13.0", + "grunt-contrib-concat": "^0.5.1", + "grunt-contrib-copy": "^0.8.1", + "grunt-contrib-cssmin": "^0.14.0", + "grunt-contrib-jst": "^0.6.0", + "grunt-contrib-less": "^1.0.1", + "grunt-contrib-uglify": "^0.9.2", + "grunt-contrib-watch": "^0.6.1", + "grunt-sails-linker": "^0.10.1", + "grunt-sync": "^0.4.1", + "include-all": "^0.1.6", + "rc": "^1.1.1", + "sails": "^0.11.2", + "sails-disk": "^0.10.0" }, "scripts": { "debug": "node debug app.js", @@ -34,5 +34,5 @@ "url": "git://github.com/beckwith/appengine-nodejs-samples.git" }, "author": "beckwith", - "license": "" + "license": "Apache Version 2.0" } \ No newline at end of file