0

I am at the point where I have to add Express 4 to my modularized AngularJS ui-router app. Previously I used this tutorial to modularize my Angular app. I currently have all the modules for my AngularJS app in the src/app/ directory like so:

$ 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

Now I am wondering how I should break up the Express 4 code to fit in with my Angular modules. I really can't find any tutorials that focus on this. Any ideas?

1 Answers1

0

When i develop client-server applications I tend to keep the server and client completely separate from each other. So I would suggest that you create a "server" folder and in there your layout could look something like this:

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

I would recommend this website: https://scotch.io

Philip
  • 2,287
  • 1
  • 22
  • 37