当前位置:网站首页>egg. JS directory structure
egg. JS directory structure
2022-07-06 08:29:00 【Liu Chu, Ge Nian】
List of articles
Directory structure
Structural view
egg-project
├── package.json
├── app.js ( Optional )
├── agent.js ( Optional )
├── app(----------- The core ------------)
| ├── router.js( route )
│ ├── controller( controller )
│ | └── home.js
│ ├── service ( Model )
│ | └── user.js
│ ├── middleware ( middleware )
│ | └── response_time.js
│ ├── schedule ( Optional )
│ | └── my_task.js
│ ├── public ( Static resources )
│ | └── reset.css
│ ├── view ( Template view )
│ | └── home.tpl
│ └── extend ( Expand )
│ ├── helper.js ( Optional )
│ ├── request.js ( Optional )
│ ├── response.js ( Optional )
│ ├── context.js ( Optional )
│ ├── application.js ( Optional )
│ └── agent.js ( Optional )
├── config
| ├── plugin.js
| ├── config.default.js
│ ├── config.prod.js
| ├── config.test.js ( Optional )
| ├── config.local.js ( Optional )
| └── config.unittest.js ( Optional )
└── test
├── middleware
| └── response_time.test.js
└── controller
└── home.test.js
The structure,
Above , The directory agreed by the framework :
app/router.jsUsed for configuration URL Routing rules , Specific see Router.app/controller/**Used to parse user input , Return corresponding results after processing , Specific see Controller.app/service/**For writing the business logic layer , Optional , It is recommended to use , Specific see Service.app/middleware/**For writing middleware , Optional , Specific see Middleware.app/public/**Used to place static resources , Optional , See the built-in plug-ins for details egg-static .app/extend/**Extension for framework , Optional , Specific see Framework extension .config/config.{env}.jsFor writing configuration files , Specific see To configure .config/plugin.jsFor configuring plug-ins that need to be loaded , Specific see plug-in unit .test/**For unit testing , Specific see unit testing .app.jsandagent.jsUsed to customize initialization at startup , Optional , Specific see Start customization . Aboutagent.jsFor more information, see Agent Mechanism .
Directory contracted by built-in plug-ins :
app/public/**Used to place static resources , Optional , See the built-in plug-ins for details egg-static .app/schedule/**For timed tasks , Optional , Specific see Timing task .
To customize your own directory specification , See Loader API
app/view/**Used to place template files , Optional , Agreed by the template plug-in , Specific see Template rendering .app/model/**For placing domain models , Optional , Agreed by domain class related plug-ins , Such as egg-sequelize .
边栏推荐
猜你喜欢

堆排序详解

【MySQL】锁

What is the use of entering the critical point? How to realize STM32 single chip microcomputer?

2022.02.13 - NC002. sort

Summary of phased use of sonic one-stop open source distributed cluster cloud real machine test platform

Hungry for 4 years + Ali for 2 years: some conclusions and Thoughts on the road of research and development

【云原生】手把手教你搭建ferry开源工单系统

指针进阶---指针数组,数组指针
![[research materials] 2021 Research Report on China's smart medical industry - Download attached](/img/c8/a205ddc2835c87efa38808cf31f59e.jpg)
[research materials] 2021 Research Report on China's smart medical industry - Download attached

Online yaml to CSV tool
随机推荐
面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读
LDAP Application Section (4) Jenkins Access
Hungry for 4 years + Ali for 2 years: some conclusions and Thoughts on the road of research and development
远程存储访问授权
C语言自定义类型:结构体
Golang force buckle leetcode 1020 Number of enclaves
Online yaml to CSV tool
MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object
Introduction to number theory (greatest common divisor, prime sieve, inverse element)
Beijing invitation media
【MySQL】锁
从表中名称映射关系修改视频名称
hcip--mpls
Research Report on supply and demand and development prospects of China's high purity aluminum market (2022 Edition)
[research materials] 2021 live broadcast annual data report of e-commerce - Download attached
All the ArrayList knowledge you want to know is here
2022.02.13 - NC001. Reverse linked list
[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes
leetcode刷题 (5.29) 哈希表
LDAP应用篇(4)Jenkins接入