From caa07034a483aa2ea487440238fe3d7129dae7fe Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Tue, 29 Aug 2017 12:16:21 +0000 Subject: [PATCH] fixing node_modules/@types/cookie-parser errors | correcting previous wrong commit for file app.module.ts git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@48850 d315682c-612b-4755-9ff5-7f18f6832af3 --- portal-2/README.md | 7 ++----- portal-2/package.json | 2 +- portal-2/src/app/app.component.ts | 4 ++-- portal-2/src/app/app.module.ts | 6 +++++- portal-2/src/server.aot.ts | 30 ++++++++---------------------- portal-2/src/server.ts | 30 ++++++++---------------------- portal-2/src/typings.d.ts | 5 ----- 7 files changed, 26 insertions(+), 58 deletions(-) diff --git a/portal-2/README.md b/portal-2/README.md index 87547810..e0546bbf 100644 --- a/portal-2/README.md +++ b/portal-2/README.md @@ -102,11 +102,8 @@ app.use(interceptor((req, res)=>({ } } else { const { output, encoding } = mcache.get(key); - if(encodings.has(encoding)){ - res.setHeader('Content-Encoding', encoding); - send(output); - return; - } + res.setHeader('Content-Encoding', encoding); + send(output); } send(output); } diff --git a/portal-2/package.json b/portal-2/package.json index dd57a51a..08ac4068 100644 --- a/portal-2/package.json +++ b/portal-2/package.json @@ -77,7 +77,7 @@ "@types/morgan": "^1.7.32", "@types/body-parser": "0.0.29", "@types/compression": "0.0.29", - "@types/cookie-parser": "^1.3.29", + "@types/cookie-parser": "1.3.30", "@types/express": "^4.0.32", "@types/express-serve-static-core": "^4.0.33", "@types/hammerjs": "^2.0.32", diff --git a/portal-2/src/app/app.component.ts b/portal-2/src/app/app.component.ts index 26e8b5c7..70a22aa3 100644 --- a/portal-2/src/app/app.component.ts +++ b/portal-2/src/app/app.component.ts @@ -5,7 +5,7 @@ import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, Vi // ** Example Directive // Notice we don't touch the Element directly -@Directive({ +/*@Directive({ selector: '[xLarge]' }) export class XLargeDirective { @@ -17,7 +17,7 @@ export class XLargeDirective { // ^^ } } - +*/ @Component({ changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.Emulated, diff --git a/portal-2/src/app/app.module.ts b/portal-2/src/app/app.module.ts index d5b997d8..841ba321 100755 --- a/portal-2/src/app/app.module.ts +++ b/portal-2/src/app/app.module.ts @@ -1,4 +1,8 @@ import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; + + +import { SharedModule } from './shared/shared.module'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; @@ -9,7 +13,7 @@ import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module import { XSRFStrategy, CookieXSRFStrategy, RequestOptions } from '@angular/http'; @NgModule({ - declarations: [ AppComponent, XLargeDirective ], + declarations: [ AppComponent ], imports: [ SharedModule, diff --git a/portal-2/src/server.aot.ts b/portal-2/src/server.aot.ts index c7fc4eb5..d643c819 100644 --- a/portal-2/src/server.aot.ts +++ b/portal-2/src/server.aot.ts @@ -76,30 +76,16 @@ import { serverApi, createTodoApi } from './backend/api'; app.get('/data.json', serverApi); app.use('/api', createTodoApi()); -process.on('uncaughtException', function (err) { - console.error('Catching uncaught errors to avoid process crash', err); -}); - function ngApp(req, res) { - - function onHandleError(parentZoneDelegate, currentZone, targetZone, error) { - console.warn('Error in SSR, serving for direct CSR'); - res.sendFile('index.html', {root: './src'}); - return false; - } - - Zone.current.fork({ name: 'CSR fallback', onHandleError }).run(() => { - res.render('index', { - req, - res, - // time: true, // use this to determine what part of your app is slow only in development - preboot: false, - baseUrl: '/', - requestUrl: req.originalUrl, - originUrl: `http://localhost:${ app.get('port') }` - }); + res.render('index', { + req, + res, + // time: true, // use this to determine what part of your app is slow only in development + preboot: false, + baseUrl: '/', + requestUrl: req.originalUrl, + originUrl: `http://localhost:${ app.get('port') }` }); - } /** diff --git a/portal-2/src/server.ts b/portal-2/src/server.ts index 532d84b2..8b12182d 100644 --- a/portal-2/src/server.ts +++ b/portal-2/src/server.ts @@ -69,30 +69,16 @@ import { serverApi, createTodoApi } from './backend/api'; app.get('/data.json', serverApi); app.use('/api', createTodoApi()); -process.on('uncaughtException', function (err) { - console.error('Catching uncaught errors to avoid process crash', err); -}); - function ngApp(req, res) { - - function onHandleError(parentZoneDelegate, currentZone, targetZone, error) { - console.warn('Error in SSR, serving for direct CSR'); - res.sendFile('index.html', {root: './src'}); - return false; - } - - Zone.current.fork({ name: 'CSR fallback', onHandleError }).run(() => { - res.render('index', { - req, - res, - // time: true, // use this to determine what part of your app is slow only in development - preboot: false, - baseUrl: '/', - requestUrl: req.originalUrl, - originUrl: `http://localhost:${ app.get('port') }` - }); + res.render('index', { + req, + res, + // time: true, // use this to determine what part of your app is slow only in development + preboot: false, + baseUrl: '/', + requestUrl: req.originalUrl, + originUrl: `http://localhost:${ app.get('port') }` }); - } /** diff --git a/portal-2/src/typings.d.ts b/portal-2/src/typings.d.ts index 74d0c00e..dd39e599 100644 --- a/portal-2/src/typings.d.ts +++ b/portal-2/src/typings.d.ts @@ -31,10 +31,6 @@ declare module 'modern-lru' { export = x; } -//declare var clipboard: any; -//import * as Clipboard from 'clipboard'; - - declare var System: SystemJS; interface SystemJS { @@ -44,7 +40,6 @@ interface SystemJS { declare var ENV: string; declare var HMR: boolean; declare var Zone: {current: any}; - interface GlobalEnvironment { ENV; HMR;