feat: add mock data routers config 69/94269/2
authorcyuamber <xuranyjy@chinamobile.com>
Mon, 26 Aug 2019 11:34:22 +0000 (19:34 +0800)
committerxu ran <xuranyjy@chinamobile.com>
Tue, 27 Aug 2019 02:22:40 +0000 (02:22 +0000)
Change-Id: I155f6957499cfb6da2462671083fa0622de6463a
Issue-ID: USECASEUI-307
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
usecaseui-portal/README.md
usecaseui-portal/src/app/core/services/text.service.ts
usecaseui-portal/src/app/mock/fake/fakedata.js [moved from usecaseui-portal/src/app/mock/fakedata.js with 100% similarity]
usecaseui-portal/src/app/mock/fake/mock.js [moved from usecaseui-portal/src/app/mock/mock.js with 100% similarity]
usecaseui-portal/src/app/mock/routes.js [new file with mode: 0644]
usecaseui-portal/src/app/mock/server.js

index 5330f32..29e92ed 100644 (file)
@@ -61,7 +61,7 @@ npm run changelog
 │   │   ├── app.component.css                                            
 │   │   ├── app.component.less                                              
 │   │   ├── app.component.html                                                                                         
-│   │   ├── app.component.ts                                                                                                            │   │   └── app.module.ts    
+│   │   ├── app.component.ts                                                                                                  
 │   ├── assets 
 │   │   ├── i18n                            # container of internationalization assets                      
 │   │   └── images   
index 26a2caa..9ccea18 100644 (file)
@@ -36,7 +36,7 @@ export class TextService {
     return this.http.get<any>(this.url["singleInterface"]);
   }
   getjsonData() {
-    return this.http.get<any>(this.url["jsonInterface"]);
+    return this.http.get<any>(this.url["multipleInterface"]);
   }
   //-------------------------------------------------------------------------------------
 
diff --git a/usecaseui-portal/src/app/mock/routes.js b/usecaseui-portal/src/app/mock/routes.js
new file mode 100644 (file)
index 0000000..aad505f
--- /dev/null
@@ -0,0 +1,10 @@
+// proxy routers setting
+module.exports =
+    {
+
+        "/api/*": "/$1",
+        "/*/*": "/$1_$2",
+        "/*/*/*": "/$1_$2_$3",
+        "/*/*/*/*": "/$1_$2_$3_$4",
+
+    }
index 45d6b2b..2b8f5fe 100644 (file)
@@ -1,6 +1,7 @@
 const jsonServer = require('json-server');
 const server = jsonServer.create();
 const middlewares = jsonServer.defaults();
+// const customersRouters = require('./routes');
 
 // Set default middlewares (logger, static, cors and no-cache)
 server.use(middlewares);
@@ -10,7 +11,7 @@ const fs = require('fs');
 const path = require('path');
 
 let localJsonDb = {};  //import mock datas
-const fakeoriginalData = require('./mock.js');  //import datas created in fakedata.js
+const fakeoriginalData = require('./fake/mock.js');  //import datas created in fakedata.js
 const mockFolder = './src/app/mock/json'; //mock json path folder
 const filePath = path.resolve(mockFolder);
 
@@ -54,8 +55,6 @@ function fileDisplay(filePath) {
         })
     })
     setTimeout(() => {
-        // console.log(rewriter, "===rewriter", localJsonDb, "===localJsonDb", fileList, "===fileList");
-        // console.log(localJsonDb, "===localJsonDb");
         serverRewrite(rewriter);
         runServer(localJsonDb);
     }, 100)