freeCodeCamp/guide/chinese/miscellaneous/backend-file-structures-in-.../index.md

10 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Backend File Structures in Angular
localeTitle: Angular中的后端文件结构
---
您的应用程序与数据库交互的后端api位于**/ server / api中**
我们来看看**/ server / api / thing**
1. **index.js** :此文件将从应用程序前端发出的$ http API请求路由到**thing.controller.js中**的相应函数
2. **thing.controller.js** 这是我们实际处理数据库的地方花点时间浏览一下看看发生了什么。这些函数将返回集合中的所有项目在传递其id时从集合返回单个项目将项目发布到集合更新集合中的项目这实际上并不像预期的那样工作我们将在一分钟内修复它当然从集合中删除一个项目。
3. **thing.model.js** 这里定义了一个_事物_对象的实际结构。您可以在_事物_模型中添加或删除任何您想要的字段只要它们在语法上是正确的它们就不会破坏任何内容即使数据库中已存在具有不同模式的_事物_ 。但您不必编辑_事物_模型来创建新类型的集合因为generator-angular-fullstack可以为您完成