0

Hi i am trying to understand the installation of Angular JS v2. I have read a lot of tutorials and right now i am very confused some are using webpack to create server and using the application, in some examples they use generators and all the generated files are in TypeScript then.

I just want to use Angular JS as frontEnd and express app as an API (RESTFUL) but i don't know how to configure it. Do i have to create two different servers for it or can i use same express server to serve index.html of angular 2 application. Kindly provide your suggestions, any tutorial link or any direction where i should dig in. Any help will be appreciated.

Thanks

1

1 Answer 1

2

You need a frontend server that is running Angular2 and a NodeJS backend server that your frontend makes HTTP requests to.

To get an Angular2 server up and running either use the Angular2 quickstart project (as referred to throughout the Angular2 docs) or use Angular CLI (this is an npm package). The Angular2 docs use SystemJS. Angular CLI uses Webpack.

For your backend server, use expressJS (another npm package).

First step for you is to install NodeJS !!! :)

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

2 Comments

How can i run both servers at localhost. Can i define api server at api.localhost at the application at localhost. I have heard of npm package vhosts but i am not able to configure it yet. Can i also use angular2 as view in express app.
no you run express as backend server it does not run angular2. you run angular2 as frontend server on its own. use angular2 quickstart. THEN start express on its own. Then make requests FROM angular2 to express via HTTP. the angular2 server and the express server run on localhost on different ports.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.