推荐的文件结构
Recommended file structure
我正在为包含 Angular 前端和 Php Slim Api.
的网站寻找起始文件结构
我目前的设置是这样的
- index.html = 斜起点
- api/
- index.php = 修身起点
- .htaccess = 重定向 http://domain/api/* 到 index.php
- (保留 php slim api 的文件夹和文件)
- 应用/
- app.modules.js, app.routes.js = 主要 js angular
- (angular 网站的剩余文件夹和文件)
- 供应商/
- node_modules/
- bower_modules/
- packages.json、composer.json、gulpfile.js = 工具的配置文件
它如我所愿地工作:index.html 启动了 angular 网站,我所有的 api 调用都在“http://domain/api/*”下,但它看起来很乱,我无法为该项目找到更好的结构。
一个解决方案是将 vendor、node_modules 和 bower_modules 存储在 'public_html' 上方的文件夹中,只保留 index.html、app 和 api 'public_html' 但我不能在我的主机中这样做。
您可以跳过后端和前端文件夹,从 Web(对于 php)和应用程序(对于 angularjs)开始。但我建议拥有这些父文件夹,以防您需要额外的文件,例如所有配置或脚本。
backend
--web/ // Public visible backend folder
-----index.php // Entry point
-----config/
-----controllers/
-----models/
frontend
--app/
----- shared/ // acts as reusable components or partials of our site
---------- sidebar/
--------------- sidebarDirective.js
--------------- sidebarView.html
---------- article/
--------------- articleDirective.js
--------------- articleView.html
----- components/ // each component is treated as a mini Angular app
---------- home/
--------------- homeController.js
--------------- homeService.js
--------------- homeView.html
---------- blog/
--------------- blogController.js
--------------- blogService.js
--------------- blogView.html
----- app.module.js
----- app.routes.js
assets/
----- img/ // Images and icons for your app
----- css/ // All styles and style related files (SCSS or LESS files)
----- js/ // JavaScript files written for your app that are not for angular
node_modules/
bower_modules/Underscore, etc.
index.html
我正在为包含 Angular 前端和 Php Slim Api.
的网站寻找起始文件结构我目前的设置是这样的
- index.html = 斜起点
- api/
- index.php = 修身起点
- .htaccess = 重定向 http://domain/api/* 到 index.php
- (保留 php slim api 的文件夹和文件)
- 应用/
- app.modules.js, app.routes.js = 主要 js angular
- (angular 网站的剩余文件夹和文件)
- 供应商/
- node_modules/
- bower_modules/
- packages.json、composer.json、gulpfile.js = 工具的配置文件
它如我所愿地工作:index.html 启动了 angular 网站,我所有的 api 调用都在“http://domain/api/*”下,但它看起来很乱,我无法为该项目找到更好的结构。
一个解决方案是将 vendor、node_modules 和 bower_modules 存储在 'public_html' 上方的文件夹中,只保留 index.html、app 和 api 'public_html' 但我不能在我的主机中这样做。
您可以跳过后端和前端文件夹,从 Web(对于 php)和应用程序(对于 angularjs)开始。但我建议拥有这些父文件夹,以防您需要额外的文件,例如所有配置或脚本。
backend
--web/ // Public visible backend folder
-----index.php // Entry point
-----config/
-----controllers/
-----models/
frontend
--app/
----- shared/ // acts as reusable components or partials of our site
---------- sidebar/
--------------- sidebarDirective.js
--------------- sidebarView.html
---------- article/
--------------- articleDirective.js
--------------- articleView.html
----- components/ // each component is treated as a mini Angular app
---------- home/
--------------- homeController.js
--------------- homeService.js
--------------- homeView.html
---------- blog/
--------------- blogController.js
--------------- blogService.js
--------------- blogView.html
----- app.module.js
----- app.routes.js
assets/
----- img/ // Images and icons for your app
----- css/ // All styles and style related files (SCSS or LESS files)
----- js/ // JavaScript files written for your app that are not for angular
node_modules/
bower_modules/Underscore, etc.
index.html