【问题标题】:Recommended file structure [closed]推荐的文件结构[关闭]
【发布时间】:2016-03-18 02:50:40
【问题描述】:

我正在寻找一个包含 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 网站的剩余文件夹和文件)
  • 供应商/
  • node_modules/
  • bower_modules/
  • packages.json、composer.json、gulpfile.js = 工具配置文件

它按我的意愿工作:index.html 启动 angular 网站,我的所有 api 调用都在“http://domain/api/*”下,但它看起来很乱,我找不到这个项目更好的结构。

一种解决方案是将供应商、node_modules 和 bower_modules 存储在“public_html”上方的文件夹中,并将 index.html、app 和 api 留在“public_html”中,但我无法在我的主机中这样做。

【问题讨论】:

    标签: php angularjs composer-php file-structure


    【解决方案1】:

    您可以跳过后端和前端文件夹,从 web(对于 php)和 app(对于 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-18
      • 1970-01-01
      • 1970-01-01
      • 2011-01-12
      • 2021-12-08
      • 1970-01-01
      • 1970-01-01
      • 2010-11-17
      相关资源
      最近更新 更多