Database access with Angular

后端 未结 3 1315
自闭症患者
自闭症患者 2021-02-10 05:23

Is it possible to access MySQL databases in Angular framework or would that be insecure like other Javascript and I will need to post to a PHP page to retrieve data/json

3条回答
  •  独厮守ぢ
    2021-02-10 06:00

    1- Is it possible to access MySQL databases in angular framework?

    The question is not angular specific but YES It's possible , since MySQL 5.7 inserting, updating and deleting records in MySQL via HTTP is possible. Something like this http://127.0.0.1:8080/sql/myhttp/SELECT+name_first,+name_last+FROM+names refer here

    Hence you can interact with MySQL directly with any HTTP client with out any middle-ware.

    By HTTP Client I mean Curl,Wget or any Http library/API of any language (ajax,request,fetch,axios ... for JavaScript/node)

    2 - Would that be insecure like other JavaScript?

    Again not JavaScript specific, But Yes it's insecure(not recommended) to directly interact with the database from the client. Why? You need to handle database security issues like SQL Injection from the client side (angular in this case). It's is very inconvenient to do that.

    I do recommend to always have database access middle-ware (php,node,python ...) than interacting from client side

提交回复
热议问题