Why would one want to use Express instead of AngularJS?

后端 未结 4 1701
刺人心
刺人心 2021-01-31 02:33

I understand that Express resides on the server and Angular resides on the client but, as far as I know, Angular can do everything that Express can do which is

  • rou
相关标签:
4条回答
  • 2021-01-31 03:03

    Express can be used to host the APIs for AngularJS's service/factory to consume. You can consider AngularJS as MVC and the API on Express as SOA.

    0 讨论(0)
  • 2021-01-31 03:09

    Express and AngularJS do not mutually exclude one another, they serve different purpose - in fact it's perfectly fine to use both - express for all your serverside logic, and Angular for client side logic.

    0 讨论(0)
  • 2021-01-31 03:13

    There are things which should be done server side (i.e. Express, not Angular), most notably user input validation - Angular, as it's client side, can be tampered.

    Also, if you'll ever want to offer access type other than web app (i.e. mobile app), you'll probably need an API anyway - Express can do this, Angular don't.

    Finally, database access - usually Angular app will need to connect to some kind of backend to perform CRUD operations. You'll either go with hosted DB like Firebase, or you'll end up using your own database. Latter scenario is more popular and you'll need Express (or similar) for that.

    0 讨论(0)
  • 2021-01-31 03:19

    There is lot of stuff that one wants to control from server. And that is the place where the server side frameworks come into picture.

    An web app is not just some html pages linked together. There are lot of other things that needs to be implemented

    • Model validation.
    • Keeping model consistent. Remember multiple users can access the same model at any give time and even change it.
    • Controlling resource access.
    • Triggering workflows.
    • Business Logic.

    and other such thing require a server framework. So as mentioned earlier the client side frameworks like AngularJS complement server side frameworks.

    0 讨论(0)
提交回复
热议问题