# 目录结构

熟悉框架的目录结构对于理解框架的设计思路会有很大帮助，同时也可以快速地规范化我们利用框架进行的开发。

```yaml
egg-project
├── package.json                # 依赖
├── app.js (可选)                # 启动时的初始化
├── agent.js (可选)              # 启动时的初始化
├── app                         # 应用
|   ├── router.js               # 路由
│   ├── controller              # 控制器
│   |   └── home.js             # 自带的 home 控制器用例
│   ├── service (可选)           # 服务
│   |   └── user.js             # 自带的 user 服务用例
│   ├── middleware (可选)        # 中间件
│   |   └── response_time.js    # 自带的 response_time 中间件用例
│   ├── schedule (可选)          # 定时任务
│   |   └── my_task.js          # 自带的 my_task 定时任务用例
│   ├── public (可选)            # 静态文件位置
│   |   └── reset.css            # 自带的 reset 样式表用例
│   ├── view (可选)              # 视图模板
│   |   └── home.tpl             # 自带的 home 视图模板用例
│   └── extend (可选)             # 扩展
│       ├── helper.js (可选)      # 自带的 helper 扩展用例
│       ├── request.js (可选)     # 自带的 request 扩展用例
│       ├── response.js (可选)    # 自带的 response 扩展用例
│       ├── context.js (可选)     # 自带的 context 扩展用例
│       ├── application.js (可选) # 自带的 application 扩展用例
│       └── agent.js (可选)       # 自带的 agent 扩展用例
├── config                        # 配置文件位置
|   ├── plugin.js                 # 插件配置（配置需加载的插件）
|   ├── config.default.js         # 默认配置文件
│   ├── config.prod.js            # 生产环境配置文件
|   ├── config.test.js (可选)      # 测试环境配置文件
|   ├── config.local.js (可选)     # 本地环境配置文件
|   └── config.unittest.js (可选)  # 单元测试配置文件
└── test                          # 测试文件位置
    ├── middleware                # 测试中间件的测试单元位置
    |   └── response_time.test.js # 自带的 response_time 测试单元用例
    └── controller                # 控制器的测试单元位置
        └── home.test.js          # 自带的 home 测试单元用例
```

[详情查看](https://eggjs.org/zh-cn/basics/structure.html)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yyaozhibo.gitbook.io/qian-duan-xue-xi/frame/eggjs/mu-lu-jie-gou.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
