From 1660cde4d4d607644363a5f987ffda0dd59a0446 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Fri, 1 Jul 2016 15:28:10 +0300 Subject: [PATCH] Initial commit --- .gitignore | 109 +++++++++++++++++++++++++++++++++++++++++++++++ .jshintrc | 3 ++ app.js | 6 +++ app.yaml | 17 ++++++++ package.json | 16 +++++++ server/server.js | 31 ++++++++++++++ 6 files changed, 182 insertions(+) create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 app.js create mode 100644 app.yaml create mode 100644 package.json create mode 100644 server/server.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..59b00d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,109 @@ + +# Created by https://www.gitignore.io/api/node,linux,osx,windows,appengine + +### Node ### +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + + +### OSX ### +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + + +### Windows ### +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + + +### AppEngine ### +# Google App Engine generated folder +appengine-generated/ diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..2119fa8 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,3 @@ +{ + "esnext": true +} diff --git a/app.js b/app.js new file mode 100644 index 0000000..41f7173 --- /dev/null +++ b/app.js @@ -0,0 +1,6 @@ +'use strict'; +var serverModule = require('./server/server'); + +var server = serverModule.getInstance(); + +server.run(); diff --git a/app.yaml b/app.yaml new file mode 100644 index 0000000..f6ffeb3 --- /dev/null +++ b/app.yaml @@ -0,0 +1,17 @@ +# 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 +# [END app_yaml] diff --git a/package.json b/package.json new file mode 100644 index 0000000..417f952 --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "the_social_notework", + "version": "0.0.1", + "description": "A sample Back ent for an Android app", + "main": "app.js", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node app.js" + }, + "author": "", + "license": "ISC", + "dependencies": { + "express": "^4.14.0" + } +} diff --git a/server/server.js b/server/server.js new file mode 100644 index 0000000..c371ae0 --- /dev/null +++ b/server/server.js @@ -0,0 +1,31 @@ +'use strict'; +var server; +var express = require('express'); + + + +class Server { + constructor() { + console.log('Pin'); + this.app = express(); + this.app.get('/', (req, res) => { + res.status(200) + .send('Hello, world - PIN PIN PIN!'); + }); + } + + run() { + var _server = this.app.listen(process.env.PORT || '8080', () => { + console.log('App listening on port %s', _server.address() + .port); + console.log('Press Ctrl+C to quit.'); + }); + } +} + +module.exports.getInstance = () => { + if (!server) { + server = new Server(); + } + return server; +};