Angular2: express
authorgustavo <gu.martinm@gmail.com>
Mon, 15 Feb 2016 00:21:10 +0000 (01:21 +0100)
committergustavo <gu.martinm@gmail.com>
Mon, 15 Feb 2016 00:21:10 +0000 (01:21 +0100)
angular2/showcase/config.js
angular2/showcase/package.json
angular2/showcase/server.js [new file with mode: 0644]

index 25e6074..5969b16 100644 (file)
@@ -19,6 +19,7 @@ System.config({
   map: {
     "angular2": "npm:angular2@2.0.0-beta.3",
     "es6-shim": "github:es-shims/es6-shim@0.34.2",
+    "fs": "github:jspm/nodelibs-fs@0.1.2",
     "reflect-metadata": "npm:reflect-metadata@0.1.3",
     "typescript": "npm:typescript@1.8.0",
     "github:jspm/nodelibs-assert@0.1.0": {
@@ -65,7 +66,7 @@ System.config({
     },
     "npm:asn1.js@4.4.0": {
       "assert": "github:jspm/nodelibs-assert@0.1.0",
-      "bn.js": "npm:bn.js@4.10.1",
+      "bn.js": "npm:bn.js@4.10.3",
       "buffer": "github:jspm/nodelibs-buffer@0.1.0",
       "inherits": "npm:inherits@2.0.1",
       "minimalistic-assert": "npm:minimalistic-assert@1.0.0",
@@ -74,7 +75,7 @@ System.config({
     "npm:assert@1.3.0": {
       "util": "npm:util@0.10.3"
     },
-    "npm:bn.js@4.10.1": {
+    "npm:bn.js@4.10.3": {
       "buffer": "github:jspm/nodelibs-buffer@0.1.0"
     },
     "npm:browserify-aes@1.0.6": {
@@ -103,14 +104,14 @@ System.config({
       "inherits": "npm:inherits@2.0.1"
     },
     "npm:browserify-rsa@4.0.0": {
-      "bn.js": "npm:bn.js@4.10.1",
+      "bn.js": "npm:bn.js@4.10.3",
       "buffer": "github:jspm/nodelibs-buffer@0.1.0",
       "constants": "github:jspm/nodelibs-constants@0.1.0",
       "crypto": "github:jspm/nodelibs-crypto@0.1.0",
       "randombytes": "npm:randombytes@2.0.2"
     },
     "npm:browserify-sign@4.0.0": {
-      "bn.js": "npm:bn.js@4.10.1",
+      "bn.js": "npm:bn.js@4.10.3",
       "browserify-rsa": "npm:browserify-rsa@4.0.0",
       "buffer": "github:jspm/nodelibs-buffer@0.1.0",
       "create-hash": "npm:create-hash@1.1.2",
@@ -146,7 +147,7 @@ System.config({
       "buffer": "github:jspm/nodelibs-buffer@0.1.0"
     },
     "npm:create-ecdh@4.0.0": {
-      "bn.js": "npm:bn.js@4.10.1",
+      "bn.js": "npm:bn.js@4.10.3",
       "buffer": "github:jspm/nodelibs-buffer@0.1.0",
       "crypto": "github:jspm/nodelibs-crypto@0.1.0",
       "elliptic": "npm:elliptic@6.2.3"
@@ -185,7 +186,7 @@ System.config({
       "minimalistic-assert": "npm:minimalistic-assert@1.0.0"
     },
     "npm:diffie-hellman@5.0.2": {
-      "bn.js": "npm:bn.js@4.10.1",
+      "bn.js": "npm:bn.js@4.10.3",
       "buffer": "github:jspm/nodelibs-buffer@0.1.0",
       "crypto": "github:jspm/nodelibs-crypto@0.1.0",
       "miller-rabin": "npm:miller-rabin@4.0.0",
@@ -193,7 +194,7 @@ System.config({
       "systemjs-json": "github:systemjs/plugin-json@0.1.0"
     },
     "npm:elliptic@6.2.3": {
-      "bn.js": "npm:bn.js@4.10.1",
+      "bn.js": "npm:bn.js@4.10.3",
       "brorand": "npm:brorand@1.0.5",
       "hash.js": "npm:hash.js@1.0.3",
       "inherits": "npm:inherits@2.0.1",
@@ -217,7 +218,7 @@ System.config({
       "util": "github:jspm/nodelibs-util@0.1.0"
     },
     "npm:miller-rabin@4.0.0": {
-      "bn.js": "npm:bn.js@4.10.1",
+      "bn.js": "npm:bn.js@4.10.3",
       "brorand": "npm:brorand@1.0.5"
     },
     "npm:parse-asn1@5.0.0": {
@@ -245,7 +246,7 @@ System.config({
       "assert": "github:jspm/nodelibs-assert@0.1.0"
     },
     "npm:public-encrypt@4.0.0": {
-      "bn.js": "npm:bn.js@4.10.1",
+      "bn.js": "npm:bn.js@4.10.3",
       "browserify-rsa": "npm:browserify-rsa@4.0.0",
       "buffer": "github:jspm/nodelibs-buffer@0.1.0",
       "create-hash": "npm:create-hash@1.1.2",
index c4f5a0a..dc70f18 100644 (file)
   "scripts": {
     "build": "tsc -w"
   },
-  "devDependencies": {},
+  "devDependencies": {
+    "express": "~4.13.4",
+    "express-http-proxy": "~0.6.0"
+  },
   "jspm": {
     "dependencies": {
       "angular2": "npm:angular2@^2.0.0-beta.3",
diff --git a/angular2/showcase/server.js b/angular2/showcase/server.js
new file mode 100644 (file)
index 0000000..05c63ce
--- /dev/null
@@ -0,0 +1,31 @@
+'use strinct';
+
+var currentDir = process.cwd();
+var express = require('express');
+var app = express();
+var port = 9000;
+var environment = process.env.NODE_ENV;
+var verbose = process.env.VERBOSE;
+
+// Back-end server for XHR requests:
+var serverPort = '8080';
+var serverName = 'localhost';
+
+
+switch (environment) {
+  default:
+    console.log('development mode');
+
+    app.use(express.static(currentDir + '/'));
+
+    // Deep linking (exclude XHR requests)
+    app.use('/((?!api)).*', express.static(currentDir + '/index.html'));
+    break;
+}
+
+app.listen(port, function() {
+  console.log('Express server listening on port ' + port);
+  console.log('env = ' + app.get('env') +
+    '\n __dirname = ' + __dirname +
+    '\n process.cwd = ' + currentDir);
+});