1

I'm building a Nodejs + Angular2 project for the first time and stuck with architecture design issue.

There are following possibilities:

  1. Develop Angular2 project separately, build and copy the files into Nodejs project
  2. Develop Angular2 project from within Nodejs project (say from public folder)
  3. Run two servers for Angular2 as frontend and Nodejs as backend (how to do this in shared hosting then? AWS is fine)

Using yeoman for creating projects for both Angular2 and Nodejs. Which is the best option? Any other idea?

1 Answer 1

1

2 is basically the solution. The work flow goes like this:

  • Start Angular Development Server.
  • Start NodeJS server.

Once you are ready to go live: - Compile Angular and build out into a public folder using ng build. This folder will be accessible to the public and holds html files, javascript files, etc. - Then, you use Nodejs to direct clients to those html files. When you use NodeJS or any other backend, this is typically how you will serve the Angular 2 files. It is also possible to develop Angular 2 SERVER SIDE instead, however, this is a bit harder and I wouldn't recommend it unless working with another framework entirely. Here is a really great tutorial that walks you through it:

https://scotch.io/tutorials/mean-app-with-angular-2-and-the-angular-cli

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks David, will look into this approach

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.