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 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。