-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathServer.js
executable file
·55 lines (44 loc) · 1.38 KB
/
Server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var express = require('express');
var app = express();
var httpServer;
// var io = require('socket.io')(httpServer);
// =============
// Configuration
// =============
var port = 3001;
var requireSecureServer = false;
// =============
// Setup Server
// =============
httpServer = require('http').Server(app);
// Some debugging
httpServer.listen(port, function () {
console.log('Server','ServerId',"Listening on * at port " + port);
});
// Directory
app.use(express.static(__dirname));
app.get('/*/*', function(req, res){
// var match = req.url.match('/(\S+)/(\S+)[/?$]/');
//var match = req.url.match(/\/(\S+)\/(\S+)(\/|$)+/);
// var match = req.url.match(/\/(\S+)\/(\S+)/);
// console.log(match[1]," ",match[2]);
console.log("goodbuy: " + req.url);
// var urlParse = url.parse(req.url);
// ignore the company name and room name.
companyName = 'a';
roomName = 'b';
res.sendFile('index.html');
/*
if ( (isUser && authorizedUser(userId,companyName,roomname)) ||
(isCamera && authorizedCamera(cameraId,compnayName,roomname)) ) {
res.sendFile(path.join(__dirname,'/../Public/index.html'));
} else {
res.send("Not Authorized");
}
*/
});
// Not being used at all.
app.get('/', function(req, res){
console.log("hello" + req.url);
res.sendFile(__dirname + '/../Public/index.html');
});