From 10eb4471ab820bb2323077cb7be8029a2e9b0759 Mon Sep 17 00:00:00 2001 From: okalintu Date: Tue, 3 Mar 2015 15:46:01 +0200 Subject: sanitized routes --- adm.html | 18 ------------------ client.js | 26 -------------------------- f/scripts/angular | 1 + f/scripts/client.js | 26 ++++++++++++++++++++++++++ f/styles/style.css | 0 f/templates/adm.html | 18 ++++++++++++++++++ f/templates/index.html | 23 +++++++++++++++++++++++ index.html | 23 ----------------------- index.js | 14 +++++++++----- 9 files changed, 77 insertions(+), 72 deletions(-) delete mode 100644 adm.html delete mode 100644 client.js create mode 120000 f/scripts/angular create mode 100644 f/scripts/client.js create mode 100644 f/styles/style.css create mode 100644 f/templates/adm.html create mode 100644 f/templates/index.html delete mode 100644 index.html diff --git a/adm.html b/adm.html deleted file mode 100644 index a602da9..0000000 --- a/adm.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - -Jono - - -
-
-
Jonoa: {{qsize}}
-
Rivi: {{que[0].row}}
-
Nimi: {{que[0].name}}
-
-
- - diff --git a/client.js b/client.js deleted file mode 100644 index fb612ed..0000000 --- a/client.js +++ /dev/null @@ -1,26 +0,0 @@ -var ioc = angular.module('ioc',[]); - -ioc.controller('ioctrl',function($scope){ - var soc= io(); - $scope.que=[]; - $scope.row=""; - $scope.name=""; - $scope.qsize=0; - - $scope.submit = function(){ - soc.emit("queadd",{"row":$scope.row,"name":$scope.name}); - $scope.row=""; - $scope.name=""; - }; - - soc.on("quedata",function(data){ - $scope.que=data; - $scope.qsize=data.length; - $scope.$apply(); - }); - - $scope.popfirst = function(){ - soc.emit("quepopfirst",""); - }; - -}); diff --git a/f/scripts/angular b/f/scripts/angular new file mode 120000 index 0000000..aaffc07 --- /dev/null +++ b/f/scripts/angular @@ -0,0 +1 @@ +../../node_modules/angular \ No newline at end of file diff --git a/f/scripts/client.js b/f/scripts/client.js new file mode 100644 index 0000000..fb612ed --- /dev/null +++ b/f/scripts/client.js @@ -0,0 +1,26 @@ +var ioc = angular.module('ioc',[]); + +ioc.controller('ioctrl',function($scope){ + var soc= io(); + $scope.que=[]; + $scope.row=""; + $scope.name=""; + $scope.qsize=0; + + $scope.submit = function(){ + soc.emit("queadd",{"row":$scope.row,"name":$scope.name}); + $scope.row=""; + $scope.name=""; + }; + + soc.on("quedata",function(data){ + $scope.que=data; + $scope.qsize=data.length; + $scope.$apply(); + }); + + $scope.popfirst = function(){ + soc.emit("quepopfirst",""); + }; + +}); diff --git a/f/styles/style.css b/f/styles/style.css new file mode 100644 index 0000000..e69de29 diff --git a/f/templates/adm.html b/f/templates/adm.html new file mode 100644 index 0000000..bbc4209 --- /dev/null +++ b/f/templates/adm.html @@ -0,0 +1,18 @@ + + + + + + +Jono + + +
+
+
Jonoa: {{qsize}}
+
Rivi: {{que[0].row}}
+
Nimi: {{que[0].name}}
+
+
+ + diff --git a/f/templates/index.html b/f/templates/index.html new file mode 100644 index 0000000..822c162 --- /dev/null +++ b/f/templates/index.html @@ -0,0 +1,23 @@ + + + + + + +Jono + + +
+
Rivi:
+
Nimi:
+ + + + + + + +
{{person.row}}{{person.name}}
+
+ + diff --git a/index.html b/index.html deleted file mode 100644 index 536f644..0000000 --- a/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - -Jono - - -
-
Rivi:
-
Nimi:
- - - - - - - -
{{person.row}}{{person.name}}
-
- - diff --git a/index.js b/index.js index 3e06e9a..b4d50e1 100644 --- a/index.js +++ b/index.js @@ -5,15 +5,18 @@ var io = require('socket.io')(http); var que = [] app.get('/', function(req, res){ - res.sendFile(__dirname + '/index.html'); -}); -app.get('/client.js', function(req, res){ - res.sendFile(__dirname + '/client.js'); + res.sendFile(__dirname + '/f/templates/index.html'); }); app.get('/adm', function(req, res){ - res.sendFile(__dirname + '/adm.html'); + res.sendFile(__dirname + '/f/templates/adm.html'); +}); + +//route all paths beginning with /f/ to real files +app.get('/f/*', function(req, res){ + res.sendFile(__dirname + req.path); }); + io.on('connection', function(socket){ socket.emit("quedata",que); @@ -29,6 +32,7 @@ io.on('connection', function(socket){ }); + }); http.listen(3000, function(){ -- cgit v1.3