Angular 2 and MySQL concepts

前端 未结 2 776
面向向阳花
面向向阳花 2020-12-16 04:56

Are there recommended concepts how to access MySQL from an Angular 2 application?

I\'m new to Angular and Typescript. I found and installed the node-mysql

相关标签:
2条回答
  • 2020-12-16 05:25

    Take a look at Angular-Meteor. If you were in any framework other than Meteor, you'd need to start implementing a series of REST endpoints to connect the server to the client.But Meteor makes writing distributed client code as simple as talking to a local database. More in this article: https://www.angular-meteor.com/tutorials/socially/angular2/3-way-data-binding

    0 讨论(0)
  • 2020-12-16 05:32

    Communication directly from Angular to Mysql is bad practice (in most cases). Angular runs client side and exposing mysql to it allows for anybody to run arbitrary SQL statements.

    The solution is to create an intermidate server. It could run nodejs, to which you can then import node-mysql. The nodejs server could expose a REST api which your angular 2 application consumes.

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