Skip to content
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

Edited readme, package.json, app.yaml, and script files for consistency. #11

Merged
merged 2 commits into from
Oct 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
**/node_modules/**
npm-debug.log
21 changes: 14 additions & 7 deletions appengine/express/README.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion appengine/express/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# limitations under the License.

runtime: nodejs
api_version: 1
vm: true
api_version: 1
env_variables:
PORT: 8080
2 changes: 1 addition & 1 deletion appengine/express/bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down
15 changes: 8 additions & 7 deletions appengine/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion appengine/express/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
28 changes: 18 additions & 10 deletions appengine/geddy/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
1 change: 1 addition & 0 deletions appengine/geddy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion appengine/geddy/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
var geddy = require('geddy');

geddy.start({
port: process.env.PORT || '3000'
port: process.env.PORT || 8080
});
1 change: 1 addition & 0 deletions appengine/grunt/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rc/public/stylesheets/style.min.css
26 changes: 17 additions & 9 deletions appengine/grunt/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
17 changes: 9 additions & 8 deletions appengine/grunt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@
"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",
"deploy": "gcloud preview app deploy app.yaml --set-default --project gruntjs-demo",
"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"
}
Expand Down
2 changes: 1 addition & 1 deletion appengine/grunt/src/bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down
2 changes: 1 addition & 1 deletion appengine/grunt/src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
48 changes: 29 additions & 19 deletions appengine/hapi/README.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions appengine/hapi/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
runtime: nodejs
vm: true
api_version: 1
env_variables:
PORT: 8080
29 changes: 20 additions & 9 deletions appengine/hapi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
server.start(function () {
console.log('Server running at:', server.info.uri);
});
Loading