From c985f306fd75baa7bc0daeaed84d743c21591d80 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Mon, 20 Jul 2015 02:48:15 +0200 Subject: [PATCH] AngularJS: showcase --- angularjs/showcase/app/app.module.js | 21 +++++++++ angularjs/showcase/app/index.html | 83 ++++++++++++++++++++++++++++++++++++ angularjs/showcase/bower.json | 32 ++++++++++++++ angularjs/showcase/package.json | 23 ++++++++++ angularjs/showcase/server.js | 24 +++++++++++ 5 files changed, 183 insertions(+) create mode 100644 angularjs/showcase/app/app.module.js create mode 100644 angularjs/showcase/app/index.html create mode 100644 angularjs/showcase/bower.json create mode 100644 angularjs/showcase/package.json create mode 100644 angularjs/showcase/server.js diff --git a/angularjs/showcase/app/app.module.js b/angularjs/showcase/app/app.module.js new file mode 100644 index 0000000..368471b --- /dev/null +++ b/angularjs/showcase/app/app.module.js @@ -0,0 +1,21 @@ +(function () { + + 'use strict'; + + angular.module('app', [ + 'ui.router', + 'ui.grid', + 'ui.grid.pagination', + 'ui.grid.expandable', + 'ui.grid.saveState', + 'ui.grid.pinning', + 'ui.grid.selection', + 'ui.grid.edit', + 'ui.grid.cellNav', + 'ui.grid.resizeColumns', + 'ui.grid.autoResize', + 'ui.bootstrap', + 'ui.bootstrap.modal' + ]); +}()); + diff --git a/angularjs/showcase/app/index.html b/angularjs/showcase/app/index.html new file mode 100644 index 0000000..7e7248f --- /dev/null +++ b/angularjs/showcase/app/index.html @@ -0,0 +1,83 @@ + + + + + + Showcase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/angularjs/showcase/bower.json b/angularjs/showcase/bower.json new file mode 100644 index 0000000..8ac0813 --- /dev/null +++ b/angularjs/showcase/bower.json @@ -0,0 +1,32 @@ +{ + "name": "showcase", + "description": "My showcase module", + "version": "0.0.1", + "keywords": [ + "showcase" + ], + "appPath": "app", + "private": "true", + "ignore": [ + "src/", + "test/", + "package.json", + "gulpfile.js", + "karma.conf.js", + "server.js" + ], + "dependencies": { + "angular-translate": "2.7.2", + "angular-ui-router": "0.2.13", + "angular-bootstrap": "0.12.1", + "bootstrap": "latest", + "sb-admin": "latest" + }, + "devDependencies": { + "angular-mocks": "latest" + }, + "resolutions": { + "angular-bootstrap": "0.12.1", + "angular": "1.x" + } +} diff --git a/angularjs/showcase/package.json b/angularjs/showcase/package.json new file mode 100644 index 0000000..2c360ed --- /dev/null +++ b/angularjs/showcase/package.json @@ -0,0 +1,23 @@ +{ + "name": "showcase", + "version": "0.0.1", + "description": "My showcase module", + "devDependencies": { + "express": "latest", + "express-http-proxy": "latest", + "gulp": "latest", + "gulp-useref": "latest", + "gulp-util": "latest", + "wiredep": "latest" + }, + "config" : { + "backend-port": "8080", + "express-port": "8081", + "backend-server-name": "gumartinm.name", + "backend-server-url": "showcase" + }, + "scripts": { + "prestart": "wiredep -s app/index.html", + "postinstall": "bower install --force-latest && wiredep -s app/index.html" + } +} diff --git a/angularjs/showcase/server.js b/angularjs/showcase/server.js new file mode 100644 index 0000000..32f6871 --- /dev/null +++ b/angularjs/showcase/server.js @@ -0,0 +1,24 @@ +var express = require('express'); +var proxy = require('express-http-proxy'); +var app = express(); + +// URL to backend server +var moduleName = process.env.npm_package_config_backend_server_url; + +// Backend server port: +var serverPort = process.env.npm_package_config_backend_port; + +// Backend server name: +var serverName = process.env.npm_package_config_backend_server_name; + + +app.use('/', express.static('app')); +app.use('/' + moduleName, proxy('http://' + serverName, { + forwardPath: function(req, res) { + return require('url').parse('/' + moduleName + req.url).path; + }, + port: serverPort +})); + + +app.listen(process.env.npm_package_config_express_port); -- 2.1.4