Skip to content

Commit f50f838

Browse files
authored
Fixed issue#251; repaired travis pipeline; fixes in server.ts (#252)
1 parent d0b4b2a commit f50f838

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ script:
88
- npm run lint
99
- npm test
1010
- npm run build:prod
11-
- npm run build:prerender
11+
- npm run prerender
1212
- npm run build:universal
1313
- npm run test:ssr

server.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { NgxRequest, NgxResponse } from '@gorniv/ngx-universal';
1212
import * as compression from 'compression';
1313
import * as cookieparser from 'cookie-parser';
1414
import { exit } from 'process';
15+
1516
// for debug
1617
require('source-map-support').install();
1718

@@ -26,8 +27,6 @@ const path = require('path');
2627
const template = fs.readFileSync(path.join('.', 'dist', 'index.html')).toString();
2728
// for mock global window by domino
2829
const win = domino.createWindow(template);
29-
// from server build
30-
const files = fs.readdirSync(`${process.cwd()}/dist-server`);
3130
// mock
3231
global['window'] = win;
3332
// not implemented property and functions
@@ -94,11 +93,11 @@ export function app() {
9493
if (test && req.url === '/test/exit') {
9594
res.send('exit');
9695
exit(0);
97-
return;
9896
}
9997

10098
next();
10199
});
100+
102101
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
103102
server.engine(
104103
'html',
@@ -111,7 +110,7 @@ export function app() {
111110
server.set('views', distFolder);
112111

113112
// Example Express Rest API endpoints
114-
// app.get('/api/**', (req, res) => { });
113+
// server.get('/api/**', (req, res) => { });
115114
// Serve static files from /browser
116115
server.get(
117116
'*.*',
@@ -122,7 +121,7 @@ export function app() {
122121

123122
// All regular routes use the Universal engine
124123
server.get('*', (req, res) => {
125-
global['navigator'] = req['headers']['user-agent'];
124+
global['navigator'] = { userAgent: req['headers']['user-agent'] } as Navigator;
126125
const http =
127126
req.headers['x-forwarded-proto'] === undefined ? 'http' : req.headers['x-forwarded-proto'];
128127

src/app/shared/services/form.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ICustomControl } from '@shared/models/form.model';
22
import { Validators } from '@angular/forms';
3-
import { Injectable } from "@angular/core";
3+
import { Injectable } from '@angular/core';
44

55
@Injectable()
66
export class FormService {

0 commit comments

Comments
 (0)