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

Added Bower sample. Closes #24. #42

Merged
merged 1 commit into from
Nov 20, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ npm-debug.log
coverage/

test/encrypted/nodejs-docs-samples.json
dump.rdb

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something created by redis-server when I run tests locally. It was bugging me, and I didn't want to accidentally commit it.

1 change: 1 addition & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
appengine/bower/public/bower_components/**
appengine/kraken/public/components/**
appengine/sails/config/**
appengine/sails/tasks/**
Expand Down
3 changes: 3 additions & 0 deletions appengine/bower/.bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "public/bower_components"
}
1 change: 1 addition & 0 deletions appengine/bower/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public/bower_components/
9 changes: 9 additions & 0 deletions appengine/bower/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Bower on Google App Engine

> [Bower][1]: A package manager for the web.

Read the [Bower + Express.js on App Engine Tutorial][2] for how to run and
deploy this sample app.

[1]: http://bower.io/
[2]: https://cloud.google.com/nodejs/resources/tools/bower
17 changes: 17 additions & 0 deletions appengine/bower/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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.
#
# [START app_yaml]
runtime: nodejs
vm: true
# [END app_yaml]
6 changes: 6 additions & 0 deletions appengine/bower/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "appengine-bower",
"dependencies": {
"jquery": "~2.1.4"
}
}
20 changes: 20 additions & 0 deletions appengine/bower/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "appengine-bower",
"description": "An example of running Bower on Google App Engine.",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"engines": {
"node": "~4.2"
},
"scripts": {
"start": "node server.js",
"postinstall": "bower install --config.interactive=false",
"deploy": "gcloud preview app deploy app.yaml"
},
"dependencies": {
"bower": "^1.6.5",
"express": "^4.13.3",
"jade": "^1.11.0"
}
}
38 changes: 38 additions & 0 deletions appengine/bower/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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';

var express = require('express');

var app = express();

// Setup view engine
app.set('view engine', 'jade');

app.use(express.static(__dirname + '/public'));

app.get('/', function(req, res) {
res.render('index');
});

var server = app.listen(
process.env.PORT || 8080,
'0.0.0.0',
function () {
var address = server.address().address;
var port = server.address().port;
console.log('App listening at http://%s:%s', address, port);
console.log('Press Ctrl+C to quit.');
}
);
26 changes: 26 additions & 0 deletions appengine/bower/views/index.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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.

doctype html
html
head
title= title
script(type='text/javascript', src='bower_components/jquery/dist/jquery.min.js')
body
h1 Hello World!
p Express.js + Bower on Google App Engine.
hr
p Using <span id="module-name"></span>, installed via Bower.
script(type='text/javascript').
$('#module-name').text('jquery')

6 changes: 6 additions & 0 deletions test/appengine/all.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ function getPath(dir) {
}

var sampleTests = [
{
dir: 'bower',
cmd: 'node',
args: ['server.js'],
msg: 'Using jquery, installed via Bower.'
},
{
dir: 'express',
deploy: true,
Expand Down