Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is nodejs mandatory for angular2, can I run with apache server?

I am using angular2 with nodejs, how about using apache/xampp. will it support or nodejs npm server is mandatory for angular2

like image 283
Karthikeyan sundaramoorthi Avatar asked Jul 27 '16 06:07

Karthikeyan sundaramoorthi


People also ask

Does NodeJS run on Apache server?

Hosting a nodejs site through apache can be organized with apache proxy module. Do not enable proxying with ProxyRequests until you have secured your server. Open proxy servers are dangerous both to your network and to the Internet at large. Setting ProxyRequests to Off does not disable use of the ProxyPass directive.

Do I need Apache with NodeJS?

You do not necessarily need Apache to run Node. js since they both accomplish the same thing - answer HTTP requests. However, they are scenarios where you might use them together. For instance, you might use Apache as a reverse-proxy to Node.

Do I need NodeJS for Angular?

You do need Node. js to develop Angular applications. All the tools you will run, while developing it, uses Node. js to run, like npm and the Angular CLI itself.

Does NodeJS replace Apache?

js can replace your Apache. If you place an Apache or NGINX instance running in reverse-proxy mode between your servers and your clients, you could handle some requests in JavaScript on Node. js and some requests in your Apache-hosted PHP, until you can completely replace all your PHP with JavaScript code.


2 Answers

Considering for development ,NodeJS is Mandatory for angular2 !

let me tell you why?

Angular2 comes with typescript support which is transpiled into javascript.

NodeJS offers typings & other dependency packages like SystemJS,RxJS which helps angular2 do thye magic you call Angular.

Though you could run angular2 apps in Xampp but recommended approach will be with NodeJS as it offers a lot more flexibility & framework support for development.

for eg. Angular-Cli is node module which helps you setup your project really fast.

On top of that node gives you flexibilty to add third party libraries easily into your project.

You can use Xampp but then you will need your server to load transpiler manually which will transpile ts files into javascript files as currently there is no support in Xampp as far as I know and that will be quite a task to do.

So I will go with NodeJS on this.

For production:

once you build bundle from your application , it can be deployed to any server which runs javascript. So in that case NodeJS is not required.

like image 182
Bhushan Gadekar Avatar answered Sep 20 '22 11:09

Bhushan Gadekar


It depends on what we are talking about.

For Development you must have NodeJS on your dev machine to load all libs, transpile TS, prepare build files and so on.

For Production server you can use whatever you want, if you have already prepared js bundles with all deps and your app, just static files with index.html, css, js, jpg files and so on..

like image 22
Oleg Barinov Avatar answered Sep 17 '22 11:09

Oleg Barinov