Skip to content

Commit

Permalink
[DO NOT MERGE] Add Leftpad SDK Example
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Prin committed Mar 24, 2016
1 parent 89d2937 commit 6327da8
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
35 changes: 35 additions & 0 deletions appengine/leftpad/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// 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.
//
'use strict';

var express = require('express');
var leftPadIOSDK = require('left-pad-io-sdk');

var app = express();

app.get('/', function(req, res) {
leftPadIOSDK.leftPad('dog', 10, '#').then(function(response){
console.log(response); // logs the response
res.status(200).send('response');
})
});

// Start the server
var server = app.listen(process.env.PORT || '8080', '0.0.0.0', function() {
console.log('App listening at http://%s:%s', server.address().address,

server.address().port);
console.log('Press Ctrl+C to quit.');
});
20 changes: 20 additions & 0 deletions appengine/leftpad/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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.

# [START app_yaml]
runtime: nodejs
vm: true

skip_files:
- ^(.*/)?.*/node_modules/.*$
# [END app_yaml]
20 changes: 20 additions & 0 deletions appengine/leftpad/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "appengine-hello-world",
"description": "Simple Hello World Node.js sample for Google App Engine",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
"node": "~4.2"
},
"scripts": {
"start": "node app.js",
"monitor": "nodemon app.js",
"deploy": "gcloud preview app deploy"
},
"dependencies": {
"express": "^4.13.4",
"left-pad-io-js-sdk": "1.0.1"
}
}

0 comments on commit 6327da8

Please sign in to comment.