0

我现在必须将 Express 4 添加到我的模块化 AngularJS ui-router 应用程序中。以前我使用本教程来模块化我的 Angular 应用程序。我目前在src/app/目录中拥有 AngularJS 应用程序的所有模块,如下所示:

$ tree -I 'node_modules|bower_components|assets|scss|test' -L 4
.
├── awsS3.js
├── bower.json
├── Gruntfile.js
├── karma.conf.js
├── karma-e2e.conf.js
├── package.json
├── README.md
├── server.js
└── src
    ├── app
    │   ├── app.module.js
    │   ├── auth
    │   │   ├── auth.ctrl.js
    │   │   ├── auth.module.js
    │   │   └── auth.serv.js
    │   ├── image
    │   │   ├── image.module.js
    │   │   ├── images.ctrl.js
    │   │   ├── image.serv.js
    │   │   ├── images.tpl.html
    │   │   ├── imageview.ctrl.js
    │   │   └── imageview.tpl.html
    │   ├── nav
    │   │   ├── login.tpl.html
    │   │   ├── nav.ctrl.js
    │   │   ├── nav.module.js
    │   │   ├── post-register.tpl.html
    │   │   ├── register.tpl.html
    │   │   └── url.fltr.js
    │   └── security.json
    ├── index.html
    └── robots.txt

现在我想知道我应该如何分解 Express 4 代码以适应我的 Angular 模块。我真的找不到任何专注于此的教程。有任何想法吗?

4

1 回答 1

0

当我开发客户端-服务器应用程序时,我倾向于将服务器和客户端完全分开。所以我建议你创建一个“服务器”文件夹,在那里你的布局可能看起来像这样:

server    
--app.js    
--server.js    
--config.js    
--controllers    
----firstController.js    
--routes    
----firstRoute.js    
--models    
----firstModel.js

我会推荐这个网站:https ://scotch.io

于 2015-02-18T22:42:11.363 回答