Giter Site home page Giter Site logo

trilonio / universal-nest Goto Github PK

View Code? Open in Web Editor NEW
296.0 296.0 62.0 2.85 MB

Nest + Angular Universal = ❤️ by @TrilonIO

Home Page: https://trilon.io

License: MIT License

TypeScript 72.79% HTML 20.44% CSS 0.76% JavaScript 6.01%
angular nestjs nodejs prerender ssr typescript universal

universal-nest's People

Contributors

dependabot[bot] avatar kamilmysliwiec avatar markpieszak avatar splaktar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

universal-nest's Issues

Update guide

Hi @kamilmysliwiec

When use npm run build:ssr && npm run serve:ssr we must open localhost:300O to see the result. Thanks for you hardwork. I looking for that type of project so long.

How can i make my nesjs angular ssr to render a particular page based on POST request to my nestjs app

Hey guys i need help with this flow,

So am working on an application that requires me to render a page once i send a POST request.

I am able to achieve with basic Nestjs MVC from my controller as usual

@Post()
@Render('index')
respondToPayRequest(@Body bd){
  return bd;
}

but am looking for a way to achieve this using

Nestjs + Angular universal (SSR)

So once a user submits a form like this

From a different website to mine

My Nestjs should respond to the POST request and render a page from Angular UNIVERSAL

Pre render locally API fails

After running npm run build:ssr && npm run serve:ssr, and then going to http://localhost:4000/speakers, I see that the speaker API fails while pre rendering, and it calls the api in the browser and then displays it, and the error in see in the console is

intercepting the url http://localhost:4000/api/speakers
ERROR HttpErrorResponse {
  headers:
   HttpHeaders { normalizedNames: Map {}, lazyUpdate: null, headers: Map {} },
  status: 0,
  statusText: 'Unknown Error',
  url: 'http://localhost:4000http://localhost:4000/api/speakers',
  ok: false,
  name: 'HttpErrorResponse',
  message:
   'Http failure response for http://localhost:4000http://localhost:4000/api/speakers: 0 Unknown Error',
  error:
   ProgressEvent {
     type: 'error',
     target:
      XMLHttpRequest {
        onloadstart: null,
        onprogress: null,
        onabort: null,
        onerror: null,
        onload: null,
        ontimeout: null,
        onloadend: null,
        _listeners: [Object],
        onreadystatechange: null,
        _anonymous: undefined,
        readyState: 4,
        response: null,
        responseText: '',
        responseType: 'text',
        responseURL: '',
        status: 0,
        statusText: '',
        timeout: 0,
        upload: [XMLHttpRequestUpload],
        _method: 'GET',
        _url: [Url],
        _sync: false,
        _headers: [Object],
        _loweredHeaders: [Object],
        _mimeOverride: null,
        _request: null,
        _response: null,
        _responseParts: null,
        _responseHeaders: null,
        _aborting: null,
        _error: null,
        _loadedBytes: 0,
        _totalBytes: 0,
        _lengthComputable: false },
     currentTarget:
      XMLHttpRequest {
        onloadstart: null,
        onprogress: null,
        onabort: null,
        onerror: null,
        onload: null,
        ontimeout: null,
        onloadend: null,
        _listeners: [Object],
        onreadystatechange: null,
        _anonymous: undefined,
        readyState: 4,
        response: null,
        responseText: '',
        responseType: 'text',
        responseURL: '',
        status: 0,
        statusText: '',
        timeout: 0,
        upload: [XMLHttpRequestUpload],
        _method: 'GET',
        _url: [Url],
        _sync: false,
        _headers: [Object],
        _loweredHeaders: [Object],
        _mimeOverride: null,
        _request: null,
        _response: null,
        _responseParts: null,
        _responseHeaders: null,
        _aborting: null,
        _error: null,
        _loadedBytes: 0,
        _totalBytes: 0,
        _lengthComputable: false },
     lengthComputable: false,
     loaded: 0,
     total: 0 } }

Error when importing ValidationPipe from @nestjs/common

With a fresh installation, I'm getting the following error:

"The "class-validator" package is missing. Please, make sure to install this library ($ npm install class-validator) to take advantage of ValidationPipe"

when I add the The ValidationPipie in server/main.ts:

import { enableProdMode } from '@angular/core';
import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import { ApplicationModule } from './app.module';

enableProdMode();

async function bootstrap() {
  const app = await NestFactory.create(ApplicationModule);
  app.enableCors({
    methods: 'GET',
    maxAge: 3600,
  });
  app.useGlobalPipes(new ValidationPipe({ skipMissingProperties: true }));
  await app.listen(4000);
}
bootstrap().catch(err => console.error(err));

Obviously, I have installed class-validator. I think the problem is related with webpack (maybe because of the use of dynamic require?). If I manually change these lines, it works:

// node_modules/@nestjs/common/pipes/validation.pipe.js l39-l40
// Before
classValidator = loadPkg('class-validator');
classTransformer = loadPkg('class-transformer');

// After
classValidator = require('class-validator'); // loadPkg('class-validator');
classTransformer = require('class-transformer'); // loadPkg('class-transformer');

If the problem is the dynamic requires, I'm afraid that this can affect to other modules of nestjs like typeorm.

Can you help me please?
Thanks in advance.

error in npm run generate:prerender

Hello
when i run npm run generate:prerender i have this error :
ERROR { Error: Uncaught (in promise): TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
at webpack_require (C:\Users\issam\Desktop\nest-nguniversal-demo\dist\prerender.js:145231:30)
at Function.requireEnsure [as e] (C:\Users\issam\Desktop\nest-nguniversal-demo\dist\prerender.js:145250:25)
at ɵ0 (C:\Users\issam\Desktop\nest-nguniversal-demo\dist\prerender.js:145445:38)

someone help me plz

use prerenderer

Hey Thx for this nice example, but i git an error on prerenderer.
the comand i use

npm run build:prerender && npm run serve:prerender

The error

Users/pascalbrewing/htdocs/universal-nest/dist/prerender.js:112618
'function' === typeof document.createEvent ? function CustomEvent (type, params) {
                      ^

ReferenceError: document is not defined
    at Object.eventmap (/htdocs/universal-nest/dist/prerender.js:112618:23)
    at __webpack_require__ (/htdocs/universal-nest/dist/prerender.js:20:30)
    at Object.NativeCustomEvent (/htdocs/universal-nest/dist/prerender.js:112490:19)
    at __webpack_require__ (/htdocs/universal-nest/dist/prerender.js:20:30)
    at Object.<anonymous> (/htdocs/universal-nest/dist/prerender.js:111775:17)
    at __webpack_require__ (//htdocs/universal-nest/dist/prerender.js:20:30)
    at Module.<anonymous> (/htdocs/universal-nest/dist/prerender.js:111017:65)
    at __webpack_require__ (/htdocs/universal-nest/dist/prerender.js:20:30)
    at Object.ng2-dragula (/htdocs/universal-nest/dist/prerender.js:105256:18)
    at __webpack_require__ (/htdocs/universal-nest/dist/prerender.js:104518:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] generate:prerender: `cd dist && node prerender`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] generate:prerender script.
npm ERR! This is probably not a problem with npm. There is likely additional logging

i didnt change anything in the code.

infos :

node -v            v8.11.3
npm -v              6.4.1

Can't resolve 'project/src' in 'project/dist/server'

after mirgate project to nx(nrwl)

$ yarn run build:ssr
...

webpack --config webpack.server.config.js --progress --colors
ERROR in ./dist/server/main.js
Module not found: Error: Can't resolve 'project/src' in 'project/dist/server'
@ ./dist/server/main.js 45:24-159
@ ./prerender.ts

ERROR in ./node_modules/@angular/core/fesm5/core.js
Module not found: Error: Can't resolve 'project/src' in 'project/node_modules/@angular/core/fesm5'
@ ./node_modules/@angular/core/fesm5/core.js 27838:15-36 27850:15-102
@ ./prerender.ts

ERROR in ./node_modules/express/lib/view.js
Module not found: Error: Can't resolve 'project/src' in 'project/node_modules/express/lib'
@ ./node_modules/express/lib/view.js 81:13-25
@ ./node_modules/express/lib/application.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./node_modules/@nestjs/ng-universal/dist/utils/setup-universal.utils.js
@ ./node_modules/@nestjs/ng-universal/dist/angular-universal.providers.js
@ ./node_modules/@nestjs/ng-universal/dist/angular-universal.module.js
@ ./node_modules/@nestjs/ng-universal/dist/index.js
@ ./node_modules/@nestjs/ng-universal/index.js
@ ./prerender.ts
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] webpack:server: webpack --config webpack.server.config.js --progress --colors
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] webpack:server script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! npm/_logs/2019-09-27T09_00_54_247Z-debug.log
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Notes on Upgrading to Angular 8

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Everything works with Angular 7, but if you upgrade your cli and then upgrade the angular universal app:

npm install -g @angular/cli@next
ng update @angular/cli @angular/core codelyzer --next

A couple of problems appear:

  1. Angular complains about the lazy loading of modules unless you change the "compilerOptions"->"module":"esNext" in the tsconfig.app.json file
  2. If you try the SSR build, you get the error already reported here - nestjs/ng-universal#64
  3. The SSR build fails, because the ng-universal/webpack-config.factory.js has this section:
test: /\module.ts$/,
                        loader: 'string-replace-loader',
                        options: {
                            search: '../server/main',
                            replace: '../dist/server/main',
                            flags: 'g'
                        }

and apparently in the latest version of string-replace-loader, including any flags in the options turns on regex, and because the periods are in there unescaped, it totally messes the replacement-

Expected behavior

Should work with Angular 8 :)

Minimal reproduction of the problem with instructions

See above

What is the motivation / use case for changing the behavior?

Getting ready for Angular 8!

Environment


Nest version: 6.0.1

 
For Tooling issues:
- Node version: 10.15.3  
- Platform:  Mac

Others:

start:server getting "SyntaxError: Unexpected token import" with some 3rd party libraries

Thanks for the great example!
I'm having a small issue here, the dev server stops working with some 3rd part libraries, e.g. Nebular.
Issue can be reproduced here: https://github.com/cj-wang/universal-nest/tree/nebular

import { InjectionToken } from '@angular/core';
^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.@nebular/theme/theme.options 

Failed to load resource: net::ERR_CONNECTION_REFUSED livereload.js:1

Hi,
With Server-Side Rendering(ssr) in dev-tools console the following error appears

Failed to load resource: net::ERR_CONNECTION_REFUSED livereload.js:1

It seems it can't find livereload.js

I've tried to install and configure webpack-livereload-plugin but doesn't work.

Any suggestionts?
Thank you

generated dist server.js needs node_modules

Hi,
when I used ng-universal in my project and generated output in /dist folder I found this output requires node_modules presence. Is that correct or I'm doing something wrong?

AFAIK dist folder should be independent and used for prod build.

Is this is correct behaviour of universal-nest, please close this issue.

Thank you.
Jakub Josef

Dev server with livereload

Thanks for all the great work, love it!

When running this locally, and developing new features there is no dev/livereload server to see your changes update the nest server.

This means running an Angular build everytime a change is made, or modifying your template manually to add new commands.

Consider the nest-cli generated project package.json:

"scripts": {
    "build": "tsc -p tsconfig.build.json",
    "format": "prettier --write \"src/**/*.ts\"",
    "start": "ts-node -r tsconfig-paths/register src/main.ts",
    "start:dev": "nodemon",
    "start:debug": "nodemon --config nodemon-debug.json",
    "prestart:prod": "rimraf dist && npm run build",
    "start:prod": "node dist/main.js",
    "lint": "tslint -p tsconfig.json -c tslint.json",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
}

Compared to this universal-nest project's package.json:

"scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "lint": "ng lint nest-nguniversal-demo",
    "build:client-and-server-bundles": "ng build --prod && ng run nest-nguniversal-demo:server:production",
    "build:prerender": "npm run build:client-and-server-bundles && npm run webpack:server && npm run generate:prerender",
    "build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server",
    "generate:prerender": "cd dist && node prerender",
    "webpack:server": "webpack --config webpack.server.config.js --progress --colors",
    "serve:prerender": "cd dist/browser && http-server -p 8080",
    "serve:ssr": "node dist/server"
}

Ideally we would have separate commands to start angular and the nest server in dev mode:

"scripts": {
    "start": "ng serve",
    "start:server": "nodemon",
}

Issue running npm start or ng serve

Hello, I just downloaded your rep and when I start the app with either npm start or ng serve (after obviously npm i) when I go to the speakers tabl I don't see anything and there is an error in the console: "Failed to load resource: the server responded with a status of 404 (Not Found)" and "HttpErrorResponse
defaultErrorLogger @ core.js:5828".
When I run you server side rendering command everything works fine. Maybe I did something wrong because I new to Universal and to NestJS.

build nest to a single js

in the example (main branch) you create a single file from the nest server (build:ssr)
where can I find code to do just that without angular (just nestjs, building to a single js file without the need for node_modules).
thanks.

Update readme for prerender step

The command for pre render works fine

npm run build:prerender && npm run serve:prerender

But I think the nextjs server should be running before we run this command so that the API can be accessed while prerendering.

Can you update the readme about this.

ReferenceError: Element is not defined

I tried to run the npm run build:ssr && npm run serve:ssr, and it returned an error:

/<project_path>/node_modules/pdfjs-dist/build/pdf.js:1057
    if (typeof Element.prototype.remove !== 'undefined') {

ReferenceError: Element is not defined

Note, that this is an existing angular app and I just added angular universal using nestjs approach.
What I did was converted angular 7 to 8, then added angular universal.

Please help.

need NestJS v.7 pre installed

Good day to you!
There are some new features I need in NestJS v.7+, but it is not possible to just update Nest.js from v.6 to v.7 with npm. One needs to build and configure this bundle with NestJS from the start. Can you please make an updated bundle with NestJS v.7 in mind?

npm run start:server fails when include 'angular-in-memory-web-api' package.

Description:

By using angular-in-memory-web-api package, i stimulate api response in my angular app as following

Screenshot from 2019-03-31 12-07-39

where in-memory-data.service.ts

Screenshot from 2019-03-31 12-08-45

After this i run npm run build:ssr which is successfully running without any failer.

but if i run npm run start:server (for development purpose using nodemon) it throws following build error.

Screenshot from 2019-03-31 12-10-25

this is my tsconfig.json

{ "compileOnSave": false, "compilerOptions": { "importHelpers": true, "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2017", "dom" ] } }
Plese support.

[Bug] Prerendering build error

This is the same issue as #28.

Clonned the project, ran npm install --verbose and then tested the ssr script, which works fine. However, the prerendering one throws an error on the build step (npm run build:prerender):

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
    at __webpack_require__ (D:\Programming\ts_projects\universal-nest\dist\prerender.js:145231:30)
    at Function.requireEnsure [as e] (D:\Programming\ts_projects\universal-nest\dist\prerender.js:145250:25)
    at ɵ0 (D:\Programming\ts_projects\universal-nest\dist\prerender.js:145445:38)
    at RouterConfigLoader.loadModuleFactory (D:\Programming\ts_projects\universal-nest\dist\prerender.js:149622:39)
    at RouterConfigLoader.load (D:\Programming\ts_projects\universal-nest\dist\prerender.js:149607:35)
    at MergeMapSubscriber.project (D:\Programming\ts_projects\universal-nest\dist\prerender.js:148610:47)
    at MergeMapSubscriber._tryNext (D:\Programming\ts_projects\universal-nest\dist\prerender.js:88799:27)
    at MergeMapSubscriber._next (D:\Programming\ts_projects\universal-nest\dist\prerender.js:88789:18)
    at MergeMapSubscriber.Subscriber.next (D:\Programming\ts_projects\universal-nest\dist\prerender.js:85348:18)
    at Observable._subscribe (D:\Programming\ts_projects\universal-nest\dist\prerender.js:87360:24)

It is way longer so I am not pasting the entire log error.
Also, the prerendering stop working when navigating to the provided urls, nothing is loaded.

The issue seems to be related to route lazy loading. If I find a solution, I will make a PR for this repo.

EXTRA INFORMATION

  • ANGULAR
Your global Angular CLI version (8.3.21) is greater than your local
version (8.1.1). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.1.1
Node: 12.14.0
OS: win32 x64
Angular: 8.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package                                    Version
--------------------------------------------------------------------
@angular-devkit/architect                  0.801.1
@angular-devkit/build-angular              0.801.1
@angular-devkit/build-optimizer            0.801.1
@angular-devkit/build-webpack              0.801.1
@angular-devkit/core                       8.1.1
@angular-devkit/schematics                 8.1.1
@ngtools/webpack                           8.1.1
@nguniversal/common                        8.1.1
@nguniversal/express-engine                8.1.1
@nguniversal/module-map-ngfactory-loader   8.1.1
@schematics/angular                        8.1.1
@schematics/update                         0.801.1
rxjs                                       6.5.2
typescript                                 3.4.4
webpack                                    4.35.2
  • NESTJS
 _   _             _      ___  _____  _____  _     _____
| \ | |           | |    |_  |/  ___|/  __ \| |   |_   _|
|  \| |  ___  ___ | |_     | |\ `--. | /  \/| |     | |
| . ` | / _ \/ __|| __|    | | `--. \| |    | |     | |
| |\  ||  __/\__ \| |_ /\__/ //\__/ /| \__/\| |_____| |_
\_| \_/ \___||___/ \__|\____/ \____/  \____/\_____/\___/


[System Information]
OS Version     : Windows 10
NodeJS Version : v12.14.0
NPM Version    : 6.13.4
[Nest Information]
platform-express version : 6.5.2
ng-universal version     : 2.0.0
common version           : 6.5.2
core version             : 6.5.2

Cheers!

UPDATE Updated all dependencies (by using ncu) to latest version and the error still shows up but the prerendering is working now.

image

serve:ssr will fail if integrated with mongodb/mongoose

I try to add a mongodb module in the server side, then run serve:ssr after fresh build:ssr. the server will fail and error is
Error: Cannot find module './drivers/node-mongodb-native/connection'
is webpack not working with mongoose?

yarn build error

yarn build:ssr
yarn run v1.12.3
$ npm run build:client-and-server-bundles && npm run webpack:server
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1544481679844-0.6985739033224607/node but npm is using .nvm/versions/node/v8.12.0/bin/node itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.

[email protected] build:client-and-server-bundles /universal-nest-master
ng build --prod && ng run nest-nguniversal-demo:server:production

Progress Plugin Invalid Options

options['colors'] is an invalid additional property
options should pass "instanceof" keyword validation
options should match exactly one schema in oneOf

ValidationError: Progress Plugin Invalid Options

options['colors'] is an invalid additional property
options should pass "instanceof" keyword validation
options should match exactly one schema in oneOf

at validateOptions (/universal-nest-master/node_modules/schema-utils/src/validateOptions.js:31:11)
at new ProgressPlugin (/universal-nest-master/node_modules/webpack/lib/ProgressPlugin.js:90:3)
at Object.getCommonConfig (/universal-nest-master/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/common.js:123:27)
at BrowserBuilder.buildWebpackConfig (/universal-nest-master/node_modules/@angular-devkit/build-angular/src/browser/index.js:74:31)
at MergeMapSubscriber.rxjs_1.of.pipe.operators_1.concatMap [as project] (/universal-nest-master/node_modules/@angular-devkit/build-angular/src/browser/index.js:31:38)
at MergeMapSubscriber._tryNext (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/mergeMap.js:65:27)
at MergeMapSubscriber._next (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/mergeMap.js:55:18)
at MergeMapSubscriber.Subscriber.next (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:64:18)
at TapSubscriber._next (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/tap.js:62:26)
at TapSubscriber.Subscriber.next (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:64:18)
at MergeMapSubscriber.notifyNext (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/mergeMap.js:84:26)
at InnerSubscriber._next (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/InnerSubscriber.js:25:21)
at InnerSubscriber.Subscriber.next (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:64:18)
at ForkJoinSubscriber.notifyComplete (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/observable/forkJoin.js:79:25)
at InnerSubscriber._complete (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/InnerSubscriber.js:32:21)
at InnerSubscriber.Subscriber.complete (/universal-nest-master/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:76:18)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:client-and-server-bundles: ng build --prod && ng run nest-nguniversal-demo:server:production
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:client-and-server-bundles script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /.npm/_logs/2018-12-10T22_41_22_649Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

POST request in app.controller

I'm trying to access this route via a http call and store in app.controller
No matter what I do, the path isn't found.

Is there any way to this?

  /**
   * Get an email from the coming soon or newsletter
   */
  @Post('send/message/email')
  public sendMessageEmail(
    @Body() body
  ) {
    console.warn(`body > `, body);
     return body;
  }

Configure webconfig file

Hello guys.
I need help.

I was using @ ng-toolkit / universal. Where does it have a local.js file

I removed him from my project and I'm working with Nest. I did all the build part for production and arresting.
I applied the files generated in dist on the server.

With the toolkit that had a webconfig, pointing the path of the local.js file that read the dist / server folder.

With Nest I found the file server-scripts.js. Putting it on my server and pointing the way the project does not open.

Is there any other webconfig setup to be done? The server is windows.

build:prerender fails

When I ran
npm run build:prerender && npm run serve:prerender

I got this error

> [email protected] generate:prerender /Users/Zama/Desktop/passion/universal-nest
> cd dist && node prerender

/Users/Zama/Desktop/passion/universal-nest/dist/prerender.js:121605
'function' === typeof document.createEvent ? function CustomEvent (type, params) {
                      ^

ReferenceError: document is not defined
    at Object.<anonymous> (/Users/Zama/Desktop/passion/universal-nest/dist/prerender.js:121605:23)
    at __webpack_require__ (/Users/Zama/Desktop/passion/universal-nest/dist/prerender.js:20:30)

Need GraphQL Implementation

Hi Kamil Myśliwiec,

I am trying @nestjs/ng-universal with GraphQL and I am getting the following error:

ERROR in ./node_modules/graphql/index.mjs 64:0-70:117
Can't reexport the named export 'visitWithTypeInfo' from non EcmaScript module (only default export is available)
@ ./node_modules/@nestjs/graphql/dist/graphql.module.js
@ ./node_modules/@nestjs/graphql/dist/index.js
@ ./node_modules/@nestjs/graphql/index.js
@ ./server/app.module.ts
@ ./server/main.ts

Note: Please let me know what and where I want to add/modify the configuration for running GraphQL with this module.

Documentation

Hey Kamil,
do you have any documentation for the universal nest module available beside the Readme and this code? What do I need to add, so that I can serve my existing Angular application with server side rendering using nest?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.