Search code examples
angularserver-side

What is the use of serverside languages if you have angular calls to server


This is probably a newby question and that is because I'm new to Angular (2, specifically) and back-end/server side:

What is the use of server side languages and frameworks like asp.net, php and etc, if you can use angular to make SQL/HTTP calls to the server side using services?

I don't know much about server side scripting and programming- only thing I've learned about it so far is GET and SET operation on 'MS access' databases using asp.net. Is that the root of my confusion?

thanks in advance!


Solution

  • Data protection and security.

    All client side code is readable for the user. So if you want to make SQL/HTTP calls to the server you will also have to save your connection string, username, password and queries client side, which will also readable by anyone who enters your site. This will have as result that everyone can manipulate your data and structure and run malicious code without you have any control over it.

    By using a server side code you will be able to check first what the user tries and break the code if the request does not meet the requirements for example: required fields are not set, request is not in the required format or user tries to run malicious code/sql injection.

    Hope this answers you question.