du31992 2016-03-18 02:50 采纳率: 0%
浏览 36
已采纳

推荐的文件结构[关闭]

I'm looking for a start file structure for a website that holds a Angular front-end and an Php Slim Api.

My current setup is like

  • index.html = Sngular start point
  • api/
    • index.php = Slim start point
    • .htaccess = redirects http://domain/api/* to index.php
    • (remain folders and files of the php slim api)
  • app/
    • app.modules.js, app.routes.js = main js angular
    • (remain folders and files of the angular website)
  • vendor/
  • node_modules/
  • bower_modules/
  • packages.json, composer.json, gulpfile.js = config files for tools

It works as I want: the index.html starts the angular website and all my api calls go under "http://domain/api/*" but it looks messy and I could not found a better structure for this project.

One solution is to store vendor, node_modules and bower_modules in a folder up the 'public_html' and leave just index.html, app and api in the 'public_html' but I can't do that in my host.

  • 写回答

1条回答 默认 最新

  • douxian7808 2016-03-18 03:26
    关注

    You can just skip backend and frontend folder and start with web (for php) and app(for angularjs). but I recommend to have these parent folders in case you need extra files like over all configs or scripts.

    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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题