From df17e59257d00dcc6874184872bac3e7413c5867 Mon Sep 17 00:00:00 2001 From: sabash-c Date: Fri, 9 Aug 2019 11:52:25 +0530 Subject: [PATCH 1/2] move file to live folder --- package.json | 5 +++-- server.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index c8952ff..06ad8d8 100644 --- a/package.json +++ b/package.json @@ -6,14 +6,15 @@ "start": "ng serve", "build": "ng build", "lint": "ng lint", + "copyToLive":"rm -rf live && cp -rf dist live", "build:client-and-server-bundles": "ng build --prod && ng run explorer2-epic:server:production", "build:prerender": "npm run build:client-and-server-bundles && npm run compile:server && npm run generate:prerender", - "build:ssr": "npm run build:client-and-server-bundles && npm run compile:server && npm run move:build", + "build:ssr": "npm run build:client-and-server-bundles && npm run compile:server && npm run move:build && npm run copyToLive", "compile:server": "tsc -p server.tsconfig.json", "move:build": "(cp -r ./server/i18n/ dist/server)", "generate:prerender": "cd dist && node prerender", "serve:prerender": "cd dist/browser && http-server", - "serve:ssr": "node dist/server" + "serve:ssr": "node live/server" }, "private": true, "dependencies": { diff --git a/server.ts b/server.ts index dd919c9..0c9d14e 100644 --- a/server.ts +++ b/server.ts @@ -63,7 +63,7 @@ enableProdMode(); const app = express(); const PORT = process.env.PORT || 4000; -const DIST_FOLDER = join(process.cwd(), "dist"); +const DIST_FOLDER = join(process.cwd(), "live"); const controllers = [ new BlockchainBlockController(), From dd20417adb6ec5566a7d4c6c7fdca6c7c653679c Mon Sep 17 00:00:00 2001 From: SuriyaR Date: Fri, 9 Aug 2019 12:00:06 +0530 Subject: [PATCH 2/2] Kernal issue --- server/controllers/BlockchainKernel.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/controllers/BlockchainKernel.ts b/server/controllers/BlockchainKernel.ts index f1225e4..b70b1fe 100644 --- a/server/controllers/BlockchainKernel.ts +++ b/server/controllers/BlockchainKernel.ts @@ -28,6 +28,15 @@ export class BlockchainKernelController { this.IntializeRoutes(); } + IsJsonString(str) { + try { + var dataJson = JSON.parse(str); + } catch (e) { + return []; + } + return dataJson; + } + public IntializeRoutes() { /** * @swagger @@ -505,6 +514,7 @@ export class BlockchainKernelController { response: Response, next: NextFunction, ) => { + var self = this; try { http.get('http://116.203.152.58:3413/v1/peers/connected', (resp) => { // console.log('resp resp respresp',resp); @@ -513,7 +523,8 @@ export class BlockchainKernelController { // A chunk of data has been recieved. resp.on('data', function (chunk) { data += chunk; - let dataJson = JSON.parse(data); + + let dataJson = self.IsJsonString(data); dataJson.forEach(function (value, i) { value['id'] = i; }); @@ -533,6 +544,7 @@ export class BlockchainKernelController { } }; + private TransactionFee = async ( request: Request, response: Response,