aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/.gitignore6
-rw-r--r--client/app/app.component.html1
-rw-r--r--client/app/app.component.scss3
-rw-r--r--client/app/app.component.ts10
-rw-r--r--client/app/main.ts4
-rw-r--r--client/components/app/app.component.html23
-rw-r--r--client/components/app/app.component.scss0
-rw-r--r--client/components/app/app.component.ts43
-rw-r--r--client/components/bootstrap.ts4
-rw-r--r--client/components/videos/add/videos-add.component.ts1
-rw-r--r--client/components/videos/list/videos-list.component.ts1
-rw-r--r--client/components/videos/watch/videos-watch.component.ts1
-rw-r--r--client/index.html24
-rw-r--r--package.json18
-rw-r--r--server.js10
15 files changed, 105 insertions, 44 deletions
diff --git a/client/.gitignore b/client/.gitignore
index 548b53226..439f0c025 100644
--- a/client/.gitignore
+++ b/client/.gitignore
@@ -1,5 +1,5 @@
1typings 1typings
2app/**/*.js 2components/**/*.js
3app/**/*.map 3components/**/*.map
4stylesheets/index.css 4stylesheets/index.css
5app/*.css 5components/**/*.css
diff --git a/client/app/app.component.html b/client/app/app.component.html
deleted file mode 100644
index b6515528b..000000000
--- a/client/app/app.component.html
+++ /dev/null
@@ -1 +0,0 @@
1<h1>{{ title }}</h1>
diff --git a/client/app/app.component.scss b/client/app/app.component.scss
deleted file mode 100644
index e7315a8e9..000000000
--- a/client/app/app.component.scss
+++ /dev/null
@@ -1,3 +0,0 @@
1h1 {
2 font-size: 100px;
3}
diff --git a/client/app/app.component.ts b/client/app/app.component.ts
deleted file mode 100644
index c908663e9..000000000
--- a/client/app/app.component.ts
+++ /dev/null
@@ -1,10 +0,0 @@
1import {Component} from 'angular2/core';
2
3@Component({
4 selector: 'my-app',
5 templateUrl: 'app/app.component.html',
6 styleUrls: [ 'app/app.component.css' ]
7})
8export class AppComponent {
9 title = "coucou";
10}
diff --git a/client/app/main.ts b/client/app/main.ts
deleted file mode 100644
index 034c15573..000000000
--- a/client/app/main.ts
+++ /dev/null
@@ -1,4 +0,0 @@
1import {bootstrap} from 'angular2/platform/browser'
2import {AppComponent} from './app.component'
3
4bootstrap(AppComponent);
diff --git a/client/components/app/app.component.html b/client/components/app/app.component.html
new file mode 100644
index 000000000..5a841ca0f
--- /dev/null
+++ b/client/components/app/app.component.html
@@ -0,0 +1,23 @@
1<div class="container">
2 <div class="row">
3 <menu class="col-md-2">
4 <div id="panel_get_videos" class="panel_button">
5 <a [routerLink]="['VideosList']" class="glyphicon glyphicon-list">Get videos</a>
6 </div>
7
8 <div id="panel_upload_video" class="panel_button">
9 <a [routerLink]="['VideosAdd']" class="glyphicon glyphicon-cloud-upload">Upload a video</a>
10 </div>
11
12 <div id="panel_make_friends" class="panel_button">
13 <a (click)='makeFriends()' class="glyphicon glyphicon-user">Make friends</a>
14 </div>
15
16 <div id="panel_quit_friends" class="panel_button">
17 <a (click)='quitFriends()' class="glyphicon glyphicon-plane">Quit friends</a>
18 </div>
19 </menu>
20
21 <router-outlet class="col-md-9"></router-outlet>
22 </div>
23</div>
diff --git a/client/components/app/app.component.scss b/client/components/app/app.component.scss
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/client/components/app/app.component.scss
diff --git a/client/components/app/app.component.ts b/client/components/app/app.component.ts
new file mode 100644
index 000000000..e2cebf535
--- /dev/null
+++ b/client/components/app/app.component.ts
@@ -0,0 +1,43 @@
1import {Component} from 'angular2/core';
2import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from 'angular2/router';
3
4import { VideosAddComponent } from '../videos/add/videos-add.component';
5import { VideosListComponent } from '../videos/list/videos-list.component';
6import { VideosWatchComponent } from '../videos/watch/videos-watch.component';
7
8@RouteConfig([
9 {
10 path: '/videos/list',
11 name: 'VideosList',
12 component: VideosListComponent,
13 useAsDefault: true
14 },
15 {
16 path: '/videos/watch/:id',
17 name: 'VideosWatch',
18 component: VideosWatchComponent
19 },
20 {
21 path: '/videos/add',
22 name: 'VideosAdd',
23 component: VideosAddComponent
24 }
25])
26
27@Component({
28 selector: 'my-app',
29 templateUrl: 'app/components/app/app.component.html',
30 styleUrls: [ 'app/components/app/app.component.css' ],
31 directives: [ ROUTER_DIRECTIVES ],
32 providers: [ ROUTER_PROVIDERS ]
33})
34
35export class AppComponent {
36 makeFriends() {
37 alert('make Friends');
38 }
39
40 quitFriends() {
41 alert('quit Friends');
42 }
43}
diff --git a/client/components/bootstrap.ts b/client/components/bootstrap.ts
new file mode 100644
index 000000000..d0f524f4a
--- /dev/null
+++ b/client/components/bootstrap.ts
@@ -0,0 +1,4 @@
1import { bootstrap } from 'angular2/platform/browser';
2import { AppComponent } from './app/app.component';
3
4bootstrap(AppComponent);
diff --git a/client/components/videos/add/videos-add.component.ts b/client/components/videos/add/videos-add.component.ts
new file mode 100644
index 000000000..0db7c0163
--- /dev/null
+++ b/client/components/videos/add/videos-add.component.ts
@@ -0,0 +1 @@
export class VideosAddComponent {}
diff --git a/client/components/videos/list/videos-list.component.ts b/client/components/videos/list/videos-list.component.ts
new file mode 100644
index 000000000..54470a5ad
--- /dev/null
+++ b/client/components/videos/list/videos-list.component.ts
@@ -0,0 +1 @@
export class VideosListComponent {}
diff --git a/client/components/videos/watch/videos-watch.component.ts b/client/components/videos/watch/videos-watch.component.ts
new file mode 100644
index 000000000..84daef336
--- /dev/null
+++ b/client/components/videos/watch/videos-watch.component.ts
@@ -0,0 +1 @@
export class VideosWatchComponent {}
diff --git a/client/index.html b/client/index.html
index 7aa408181..f971b9fdb 100644
--- a/client/index.html
+++ b/client/index.html
@@ -6,27 +6,29 @@
6 6
7 <!-- 1. Load libraries --> 7 <!-- 1. Load libraries -->
8 <!-- IE required polyfills, in this exact order --> 8 <!-- IE required polyfills, in this exact order -->
9 <script src="node_modules/es6-shim/es6-shim.min.js"></script> 9 <script src="app/node_modules/es6-shim/es6-shim.min.js"></script>
10 <script src="node_modules/systemjs/dist/system-polyfills.js"></script> 10 <script src="app/node_modules/systemjs/dist/system-polyfills.js"></script>
11 <script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script> 11 <script src="app/node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
12 12
13 <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script> 13 <script src="app/node_modules/angular2/bundles/angular2-polyfills.js"></script>
14 <script src="node_modules/systemjs/dist/system.src.js"></script> 14 <script src="app/node_modules/systemjs/dist/system.src.js"></script>
15 <script src="node_modules/rxjs/bundles/Rx.js"></script> 15 <script src="app/node_modules/rxjs/bundles/Rx.js"></script>
16 <script src="node_modules/angular2/bundles/angular2.dev.js"></script> 16 <script src="app/node_modules/angular2/bundles/angular2.dev.js"></script>
17 <script src="node_modules/angular2/bundles/router.dev.js"></script> 17 <script src="app/node_modules/angular2/bundles/router.dev.js"></script>
18 18
19 <!-- 2. Configure SystemJS --> 19 <!-- 2. Configure SystemJS -->
20 <script> 20 <script>
21 System.config({ 21 System.config({
22 packages: { 22 packages: {
23 app: { 23 app: {
24 format: 'register', 24 components: {
25 defaultExtension: 'js' 25 format: 'register',
26 defaultExtension: 'js'
27 }
26 } 28 }
27 } 29 }
28 }); 30 });
29 System.import('app/main') 31 System.import('app/components/bootstrap')
30 .then(null, console.error.bind(console)); 32 .then(null, console.error.bind(console));
31 </script> 33 </script>
32 34
diff --git a/package.json b/package.json
index cebd5b506..aabd5616f 100644
--- a/package.json
+++ b/package.json
@@ -20,18 +20,18 @@
20 "build": "concurrently \"npm run client:sass\" \"npm run client:tsc\"", 20 "build": "concurrently \"npm run client:sass\" \"npm run client:tsc\"",
21 "client:clean": "concurrently \"npm run client:tsc:clean\" \"npm run client:sass:clean\"", 21 "client:clean": "concurrently \"npm run client:tsc:clean\" \"npm run client:sass:clean\"",
22 "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", 22 "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",
23 "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", 23 "client:sass:index:watch": "cd client && node-sass -w --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css",
24 "client:sass:index:clean": "cd client && rm -f stylesheets/index.css", 24 "client:sass:index:clean": "cd client && rm -f stylesheets/index.css",
25 "client:sass:app": "cd client && node-sass app/ --output app/", 25 "client:sass:components": "cd client && node-sass components/ --output components/",
26 "client:sass:app:watch": "cd client && node-sass -w app/ --output app/", 26 "client:sass:components:watch": "cd client && node-sass -w components/ --output components/",
27 "client:sass:app:clean": "cd client && rm -f app/*.css", 27 "client:sass:components:clean": "cd client && rm -f components/**/*.css",
28 "client:sass": "concurrently \"npm run client:sass:index\" \"npm run client:sass:app\"", 28 "client:sass": "concurrently \"npm run client:sass:index\" \"npm run client:sass:components\"",
29 "client:sass:watch": "concurrently \"npm run client:sass:index:watch\" \"npm run client:sass:app:watch\"", 29 "client:sass:watch": "concurrently \"npm run client:sass:index:watch\" \"npm run client:sass:components:watch\"",
30 "client:sass:clean": "concurrently \"npm run client:sass:index:clean\" \"npm run client:sass:app:clean\"", 30 "client:sass:clean": "concurrently \"npm run client:sass:index:clean\" \"npm run client:sass:components:clean\"",
31 "client:tsc": "cd client && npm run tsc", 31 "client:tsc": "cd client && npm run tsc",
32 "client:tsc:watch": "cd client && npm run tsc:w", 32 "client:tsc:watch": "cd client && npm run tsc:w",
33 "client:tsc:clean": "cd client && rm -f app/*.js app/*.js.map", 33 "client:tsc:clean": "cd client && rm -f components/**/*.js components/**/*.js.map",
34 "dev": "concurrently \"npm run livereload\" \"npm run client:tsc:watch\" \"npm run client:sass:watch\" \"npm start\"", 34 "dev": "npm run build && concurrently \"npm run livereload\" \"npm run client:tsc:watch\" \"npm run client:sass:watch\" \"npm start\"",
35 "livereload": "livereload ./client", 35 "livereload": "livereload ./client",
36 "start": "node server", 36 "start": "node server",
37 "test": "standard && mocha server/tests" 37 "test": "standard && mocha server/tests"
diff --git a/server.js b/server.js
index 72c2e7cd1..cf594453d 100644
--- a/server.js
+++ b/server.js
@@ -66,13 +66,17 @@ app.use(require('connect-livereload')({
66// Catch sefaults 66// Catch sefaults
67require('segfault-handler').registerHandler() 67require('segfault-handler').registerHandler()
68 68
69// Static files
70app.use(express.static(path.join(__dirname, '/client'), { maxAge: 0 }))
71
72// API routes 69// API routes
73var api_route = '/api/' + constants.API_VERSION 70var api_route = '/api/' + constants.API_VERSION
74app.use(api_route, routes.api) 71app.use(api_route, routes.api)
75 72
73// Static files
74app.use('/app', express.static(path.join(__dirname, '/client'), { maxAge: 0 }))
75// 404 for static files not found
76app.use('/app/*', function (req, res, next) {
77 res.sendStatus(404)
78})
79
76// Client application 80// Client application
77app.use('/*', function (req, res, next) { 81app.use('/*', function (req, res, next) {
78 res.sendFile(path.join(__dirname, 'client/index.html')) 82 res.sendFile(path.join(__dirname, 'client/index.html'))