forked from streamium/streamium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
60 lines (47 loc) · 1.4 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
56
57
58
59
60
'use strict';
var fs = require('fs');
var https = require('https');
var express = require('express');
var app = express();
// This routes enables HTML5Mode by forwarding missing files to the index.html
app.configure(function(){
// Livenet
app.all('/b/*', function(req, res) {
res.sendfile('./index.html');
});
app.all('/s/*', function(req, res) {
res.sendfile('./index.html');
});
app.use('/', express.static('.'));
app.all('/screen', function(req, res) {
res.sendfile('./index.html');
});
app.all('/t/screen', function(req, res) {
res.sendfile('./testnet/index.html');
});
app.all('/static', function(req, res) {
res.sendfile('./index.html');
});
app.all('/t/static', function(req, res) {
res.sendfile('./testnet/index.html');
});
// Testnet
app.all('/t/b/*', function(req, res) {
res.sendfile('./testnet/index.html');
});
app.all('/t/s/*', function(req, res) {
res.sendfile('./testnet/index.html');
});
app.use('/t', express.static('./testnet'));
app.use('/tutorial-address', express.static('.'));
});
var port = 8443;
var secureServer = https.createServer({
key: fs.readFileSync('./ssl/server.key'),
cert: fs.readFileSync('./ssl/server.crt'),
ca: fs.readFileSync('./ssl/ca.crt'),
requestCert: true,
rejectUnauthorized: false
}, app).listen(port, function() {
console.log("Secure Express server listening on port " + port);
});