Difference between API integration using AngularJS and ExpressJS in MEAN stack application?
I am developing a MEAN stack application. I found that we are using API calls integration using ExpressJS and we using angularJS for the expressJS calls. We can do the same with angular using $http. What is the difference ?
It's the question of, why should you? By going for MEAN Stack, You decided to use Expressjs/Nodejs as your backend and Angularjs as front end. So it is not wise to call API directly in view, which thereby expose critical API information. If you are going to call API from view, how are you going to pass the API credentials securely? How are you going to manage it?
That is why, you should always have another layer a.k.a Angular calls, to Expressjs which then communicate with the API by fetching the API creds and make the call for you! This is how we are separating view and business logic! But if you don't care about any of those standards and want to call API directly in view just for fun, you can do it. But will you?
Rajkumar
Fullstack Developer.
It's the question of, why should you? By going for MEAN Stack, You decided to use Expressjs/Nodejs as your backend and Angularjs as front end. So it is not wise to call API directly in view, which thereby expose critical API information. If you are going to call API from view, how are you going to pass the API credentials securely? How are you going to manage it?
That is why, you should always have another layer a.k.a Angular calls, to Expressjs which then communicate with the API by fetching the API creds and make the call for you! This is how we are separating view and business logic! But if you don't care about any of those standards and want to call API directly in view just for fun, you can do it. But will you?