GithubHelp home page GithubHelp logo

servrox / nx-ng-nest-universal Goto Github PK

View Code? Open in Web Editor NEW
35.0 2.0 7.0 704 KB

Nx Workspace with a seperated Nest App for Angular Universal SSR.

TypeScript 78.80% JavaScript 14.20% HTML 6.47% CSS 0.53%
nx nestjs nest angular angular-univeral server-side-rendering ssr nodejs typescript enterprise-angular-applications

nx-ng-nest-universal's Introduction

Nx Workspace with Angular Universal via Nest

This project was generated using Nx. It currently includes an Angular App with server side rendering (SSR) via Nest.

master branch -> nx workspace with two apps (angular + nest) -> Step 1. - 6.
single-app branch -> nx workspace with single app (angular) -> Step 1. - 4.



Steps to Reproduce

1. Create Nx Workspace

npx create-nx-workspace nx-ng-nest-universal --npm-scope=ss --style=scss

2. Generate Angular App

ng g app ng-test-app --prefix=ss-test --routing=true --style=scss

3. Add Angular Universal module for Nest

ng add @nestjs/ng-universal --clientProject=ng-test-app --project=ng-test-app

4. Adjustments to make everything work. (s. Commit)

1. rimraf yarn.lock && npm i (to avoid packages conflicts)
2. Fix fileReplacements for ng-test-app:server:production in angular.json
3. Edit webpack.server.config.js

✔️ Nx App + SSR working. Move on if you want to have nest as a seperated app in your workspace.


5. Generate Nest App

ng g node-app nest-test-app --framework=nestjs

6. Adjustments to use the freshly generated Nest App for SSR (s. Commit)

1. Mainly move and edit generated files from Step 3
2. Add @nestjs/ng-universal to nest app in workspace

✔️ Nx Workspace with seperated Nest App for SSR working.


Getting Started (Build and Serve)

> git clone https://github.com/servrox/nx-ng-nest-universal.git
> cd nx-ng-nest-universal\
> npm i

npm run build:ssr && npm run serve:ssr

> npm run go

or for development

> npm run serve

UI at http://localhost:4000/
API at http://localhost:4000/api


Built With

Authors

nx-ng-nest-universal's People

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

Watchers

 avatar  avatar

nx-ng-nest-universal's Issues

Replacing environment / production

Hi,

Thank you for all your hard work here, I finally managed to get it to work on my project.

I was wondering if in the NEST project there is a quick way of replacing the environment and environment production - depending on if its a prod verson?

As, technically it doesn;'t run directly through angular.json it doesn't take into consideration the replacement feature

have any ideas ?

Importing library breaks build

When creating a library and importing a module into the main apps app.module, the build breaks for both npm run serve and npm run go.

ERROR in src/app/app.module.ts(14,5): Error during template compile of 'AppModule' Could not resolve @ss/shared/ui relative to [object Object]..

I've create a test repo/branch here.

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.