Reputation: 35
I am a newbie in Angular world, but I am seasoned backend programmer (java and golang). I have few questions.
1.) Does angularjs app need to be served using nodeJS on the server side?
2.) Is angularJS only client side code? if that is the case, can I serve it simply using apache?
3.) If AngularJS is client side code, does it not impose security risk, because it calls API and all the API keys and secrets are embedded in the javascript.
Maybe I am missing something here.
Really appreciate some pointers. I tried to look around the web, couldn't find a satisfying answer.
Thanks, Brijesh
Upvotes: 2
Views: 88
Reputation: 3914
Angular is purely client-side code, like all js (well, "most", when you consider node.js on the server-side).
It doesn't impose any additional security concerns beyond what you already get from 1. using js and 2. using any js framework.
For APIs, you'll of course need to communicate with your own API for anything server-side. In general, it's best to proxy any communication with third-party APIs through endpoints on your server.
Upvotes: 1
Reputation: 8233
1.) Does angularjs app need to be served using nodeJS on the server side?
No. I developed Wordpress themes with Angular in client side, which is requesting Wordpress API to display posts, pages, etc.
2.) Is angularJS only client side code? if that is the case, can I serve it simply using apache?
Yes and yes.
3.) If AngularJS is client side code, does it not impose security risk, because it calls API and all the API keys and secrets are embedded in the javascript.
Setting the API keys in client side is a security risk, that's why you souldn't do it. So, how to deal with API from Angular or any client side technology? You simply use something in the back-end which will provide an interface between the client and the final API.
e.g.:
Angular request -> PHP script which will request the API -> API
and then
API response -> PHP script (containing the API credentials) getting back the response from the API -> Angular getting back the response from the PHP script.
NB: The use of PHP is just an example, you can do that with any server-side language you want.
Upvotes: 1
Reputation: 1450
1.) Does angularjs app need to be served using nodeJS on the server side?
No, angular can be served with any web server.
2.) Is angularJS only client side code? if that is the case, can I serve it simply using apache?
Yes, angular is a front end, or client side framework, and can be served with apache.
3.) If AngularJS is client side code, does it not impose security risk, because it calls API and all the API keys and secrets are embedded in the javascript.
You probably shouldn't be calling APIs from client side, instead the client should request from your server, your server will deal with the APIs, and serve your client the information needed
Upvotes: 2