Files
freeCodeCamp/guide/chinese/miscellaneous/accessing-the-database-from-your-front-end/index.md
2018-10-16 21:32:40 +05:30

12 lines
569 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Accessing the Database from Your Front End
localeTitle: 从前端访问数据库
---
你一定注意到在**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_函数的示例多好