freeCodeCamp/guide/chinese/miscellaneous/accessing-the-database-from.../index.md

569 B
Raw Blame History

title localeTitle
Accessing the Database from Your Front End 从前端访问数据库

你一定注意到在main.controller.js _事情_是如何从数据库中检索并显示

$http.get('/api/things').success(function(awesomeThings){ 
    $scope.awesomeThings = awesomeThings; 
 }); 

这样做是调用API与“取”请求然后由**/server/api/things/index.js路由到things.controller.js的_exports.index_功能。您还会在main.controller.js**中注意到还包含了_ http.post_和_ http.delete_函数的示例多好