typings
-app/**/*.js
-app/**/*.map
+components/**/*.js
+components/**/*.map
stylesheets/index.css
-app/*.css
+components/**/*.css
+++ /dev/null
-<h1>{{ title }}</h1>
+++ /dev/null
-h1 {
- font-size: 100px;
-}
+++ /dev/null
-import {Component} from 'angular2/core';
-
-@Component({
- selector: 'my-app',
- templateUrl: 'app/app.component.html',
- styleUrls: [ 'app/app.component.css' ]
-})
-export class AppComponent {
- title = "coucou";
-}
+++ /dev/null
-import {bootstrap} from 'angular2/platform/browser'
-import {AppComponent} from './app.component'
-
-bootstrap(AppComponent);
--- /dev/null
+<div class="container">
+ <div class="row">
+ <menu class="col-md-2">
+ <div id="panel_get_videos" class="panel_button">
+ <a [routerLink]="['VideosList']" class="glyphicon glyphicon-list">Get videos</a>
+ </div>
+
+ <div id="panel_upload_video" class="panel_button">
+ <a [routerLink]="['VideosAdd']" class="glyphicon glyphicon-cloud-upload">Upload a video</a>
+ </div>
+
+ <div id="panel_make_friends" class="panel_button">
+ <a (click)='makeFriends()' class="glyphicon glyphicon-user">Make friends</a>
+ </div>
+
+ <div id="panel_quit_friends" class="panel_button">
+ <a (click)='quitFriends()' class="glyphicon glyphicon-plane">Quit friends</a>
+ </div>
+ </menu>
+
+ <router-outlet class="col-md-9"></router-outlet>
+ </div>
+</div>
--- /dev/null
+import {Component} from 'angular2/core';
+import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from 'angular2/router';
+
+import { VideosAddComponent } from '../videos/add/videos-add.component';
+import { VideosListComponent } from '../videos/list/videos-list.component';
+import { VideosWatchComponent } from '../videos/watch/videos-watch.component';
+
+@RouteConfig([
+ {
+ path: '/videos/list',
+ name: 'VideosList',
+ component: VideosListComponent,
+ useAsDefault: true
+ },
+ {
+ path: '/videos/watch/:id',
+ name: 'VideosWatch',
+ component: VideosWatchComponent
+ },
+ {
+ path: '/videos/add',
+ name: 'VideosAdd',
+ component: VideosAddComponent
+ }
+])
+
+@Component({
+ selector: 'my-app',
+ templateUrl: 'app/components/app/app.component.html',
+ styleUrls: [ 'app/components/app/app.component.css' ],
+ directives: [ ROUTER_DIRECTIVES ],
+ providers: [ ROUTER_PROVIDERS ]
+})
+
+export class AppComponent {
+ makeFriends() {
+ alert('make Friends');
+ }
+
+ quitFriends() {
+ alert('quit Friends');
+ }
+}
--- /dev/null
+import { bootstrap } from 'angular2/platform/browser';
+import { AppComponent } from './app/app.component';
+
+bootstrap(AppComponent);
--- /dev/null
+export class VideosAddComponent {}
--- /dev/null
+export class VideosListComponent {}
--- /dev/null
+export class VideosWatchComponent {}
<!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order -->
- <script src="node_modules/es6-shim/es6-shim.min.js"></script>
- <script src="node_modules/systemjs/dist/system-polyfills.js"></script>
- <script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
+ <script src="app/node_modules/es6-shim/es6-shim.min.js"></script>
+ <script src="app/node_modules/systemjs/dist/system-polyfills.js"></script>
+ <script src="app/node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
- <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
- <script src="node_modules/systemjs/dist/system.src.js"></script>
- <script src="node_modules/rxjs/bundles/Rx.js"></script>
- <script src="node_modules/angular2/bundles/angular2.dev.js"></script>
- <script src="node_modules/angular2/bundles/router.dev.js"></script>
+ <script src="app/node_modules/angular2/bundles/angular2-polyfills.js"></script>
+ <script src="app/node_modules/systemjs/dist/system.src.js"></script>
+ <script src="app/node_modules/rxjs/bundles/Rx.js"></script>
+ <script src="app/node_modules/angular2/bundles/angular2.dev.js"></script>
+ <script src="app/node_modules/angular2/bundles/router.dev.js"></script>
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
- format: 'register',
- defaultExtension: 'js'
+ components: {
+ format: 'register',
+ defaultExtension: 'js'
+ }
}
}
});
- System.import('app/main')
+ System.import('app/components/bootstrap')
.then(null, console.error.bind(console));
</script>
"build": "concurrently \"npm run client:sass\" \"npm run client:tsc\"",
"client:clean": "concurrently \"npm run client:tsc:clean\" \"npm run client:sass:clean\"",
"client:sass:index": "npm run client:sass:index:clean && cd client && node-sass --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css",
- "client:sass:index:watch": "npm run client:sass:index:clean && cd client && node-sass -w --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css",
+ "client:sass:index:watch": "cd client && node-sass -w --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css",
"client:sass:index:clean": "cd client && rm -f stylesheets/index.css",
- "client:sass:app": "cd client && node-sass app/ --output app/",
- "client:sass:app:watch": "cd client && node-sass -w app/ --output app/",
- "client:sass:app:clean": "cd client && rm -f app/*.css",
- "client:sass": "concurrently \"npm run client:sass:index\" \"npm run client:sass:app\"",
- "client:sass:watch": "concurrently \"npm run client:sass:index:watch\" \"npm run client:sass:app:watch\"",
- "client:sass:clean": "concurrently \"npm run client:sass:index:clean\" \"npm run client:sass:app:clean\"",
+ "client:sass:components": "cd client && node-sass components/ --output components/",
+ "client:sass:components:watch": "cd client && node-sass -w components/ --output components/",
+ "client:sass:components:clean": "cd client && rm -f components/**/*.css",
+ "client:sass": "concurrently \"npm run client:sass:index\" \"npm run client:sass:components\"",
+ "client:sass:watch": "concurrently \"npm run client:sass:index:watch\" \"npm run client:sass:components:watch\"",
+ "client:sass:clean": "concurrently \"npm run client:sass:index:clean\" \"npm run client:sass:components:clean\"",
"client:tsc": "cd client && npm run tsc",
"client:tsc:watch": "cd client && npm run tsc:w",
- "client:tsc:clean": "cd client && rm -f app/*.js app/*.js.map",
- "dev": "concurrently \"npm run livereload\" \"npm run client:tsc:watch\" \"npm run client:sass:watch\" \"npm start\"",
+ "client:tsc:clean": "cd client && rm -f components/**/*.js components/**/*.js.map",
+ "dev": "npm run build && concurrently \"npm run livereload\" \"npm run client:tsc:watch\" \"npm run client:sass:watch\" \"npm start\"",
"livereload": "livereload ./client",
"start": "node server",
"test": "standard && mocha server/tests"
// Catch sefaults
require('segfault-handler').registerHandler()
-// Static files
-app.use(express.static(path.join(__dirname, '/client'), { maxAge: 0 }))
-
// API routes
var api_route = '/api/' + constants.API_VERSION
app.use(api_route, routes.api)
+// Static files
+app.use('/app', express.static(path.join(__dirname, '/client'), { maxAge: 0 }))
+// 404 for static files not found
+app.use('/app/*', function (req, res, next) {
+ res.sendStatus(404)
+})
+
// Client application
app.use('/*', function (req, res, next) {
res.sendFile(path.join(__dirname, 'client/index.html'))