diff options
author | cyuamber <xuranyjy@chinamobile.com> | 2019-08-26 19:34:22 +0800 |
---|---|---|
committer | xu ran <xuranyjy@chinamobile.com> | 2019-08-27 02:22:40 +0000 |
commit | 5d38fbfc424c6b0a1803175989241a7cfd6ce5ff (patch) | |
tree | 3ef4fa58243066806247fb20bd5777c224657bf9 | |
parent | 53dc95156c32bb4e2a97a0b852a0c491f297889d (diff) |
feat: add mock data routers config
Change-Id: I155f6957499cfb6da2462671083fa0622de6463a
Issue-ID: USECASEUI-307
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
-rw-r--r-- | usecaseui-portal/README.md | 2 | ||||
-rw-r--r-- | usecaseui-portal/src/app/core/services/text.service.ts | 2 | ||||
-rw-r--r-- | usecaseui-portal/src/app/mock/fake/fakedata.js (renamed from usecaseui-portal/src/app/mock/fakedata.js) | 0 | ||||
-rw-r--r-- | usecaseui-portal/src/app/mock/fake/mock.js (renamed from usecaseui-portal/src/app/mock/mock.js) | 0 | ||||
-rw-r--r-- | usecaseui-portal/src/app/mock/routes.js | 10 | ||||
-rw-r--r-- | usecaseui-portal/src/app/mock/server.js | 5 |
6 files changed, 14 insertions, 5 deletions
diff --git a/usecaseui-portal/README.md b/usecaseui-portal/README.md index 5330f323..29e92ed4 100644 --- a/usecaseui-portal/README.md +++ b/usecaseui-portal/README.md @@ -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 diff --git a/usecaseui-portal/src/app/core/services/text.service.ts b/usecaseui-portal/src/app/core/services/text.service.ts index 26a2caad..9ccea18a 100644 --- a/usecaseui-portal/src/app/core/services/text.service.ts +++ b/usecaseui-portal/src/app/core/services/text.service.ts @@ -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/fakedata.js b/usecaseui-portal/src/app/mock/fake/fakedata.js index a008c14a..a008c14a 100644 --- a/usecaseui-portal/src/app/mock/fakedata.js +++ b/usecaseui-portal/src/app/mock/fake/fakedata.js diff --git a/usecaseui-portal/src/app/mock/mock.js b/usecaseui-portal/src/app/mock/fake/mock.js index 2864d4c5..2864d4c5 100644 --- a/usecaseui-portal/src/app/mock/mock.js +++ b/usecaseui-portal/src/app/mock/fake/mock.js diff --git a/usecaseui-portal/src/app/mock/routes.js b/usecaseui-portal/src/app/mock/routes.js new file mode 100644 index 00000000..aad505f2 --- /dev/null +++ b/usecaseui-portal/src/app/mock/routes.js @@ -0,0 +1,10 @@ +// proxy routers setting +module.exports = + { + + "/api/*": "/$1", + "/*/*": "/$1_$2", + "/*/*/*": "/$1_$2_$3", + "/*/*/*/*": "/$1_$2_$3_$4", + + } diff --git a/usecaseui-portal/src/app/mock/server.js b/usecaseui-portal/src/app/mock/server.js index 45d6b2b5..2b8f5fe0 100644 --- a/usecaseui-portal/src/app/mock/server.js +++ b/usecaseui-portal/src/app/mock/server.js @@ -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) |