Created
November 7, 2016 20:50
-
-
Save rkt2spc/15eae2299edb92d89b2bf8c2a74650cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Project Structure | |
- index.js //Your NodeJs code | |
- /public // What in here is your tradition Angular App (like the one on Angular Tutorial) | |
- /css | |
- /js | |
- app.js // Your Angular code | |
- index.html | |
================= Server Side ============================= | |
//Node index.js | |
var express = require('express'); | |
var app = express(); | |
app.use(express.static(__dirname + '/public'); | |
app.listen(1337); | |
================= Client Side ============================== | |
//index.html | |
.... | |
<script src="/js/app.js"></script> | |
//Angular app.js | |
var app = angular.module('app', []); | |
var services = angular.module('services', []); | |
================= Bonuses =================================== | |
Yeah, having all javascript on one file (app.js) sucks | |
Just write multiple module on different files, and use some build tool (GulpJs, GruntJs, etc) to concat them | |
Your project structure then | |
/public | |
- /build //Expose this directory over express.static | |
- /js | |
- app.js //Yep only one file after build, this is important because in your html you only have a single script tag for app.js | |
- /src | |
- /js | |
- /controllers | |
- /services | |
- app.module.js | |
- services.module.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment