forked from tutao/tutanota
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver-h2.js
76 lines (67 loc) · 3.42 KB
/
server-h2.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
'use strict'
// http2 server
const nodeStatic = require('node-static')
const file = new nodeStatic.Server('build', {cache: false, gzip: true});
const http = require('spdy')
var fs = require('fs');
var options = {
key: `-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC1q/qXIC/sGPQ7
zZYOOs83Bp4SeLW29aeuDWHUWI05o5W4z8g7sVyDHleY59UAdhesD9mlLQDLB0kR
u0dMyaoX+sA5t5zHpPAqeILXbCvhgF88CR/zOkf6OKbBU4owLWMLfUnW+wCXiAHI
hmEypl6EYATNJOY7vl6TudYGT89alRqJHdf6bcaQ7WI6zIz5uqVlD761LhX36sID
r6psUMLnx1PlrJn0rG8sK8e61QaiMwbuPxoya5Jy2PdTQpSJiDJMz9uYqryLh9C7
/zDiJa5Gq0QuBioVkyE8VUmaYacCh0gznqyjYakTR8sD7qPycqEuCE8Zniq2cw22
G+Lnn9PFAgMBAAECggEAaG5xAXiuM5DwrIP0kz95KE90hHfBNWgnOKVWrEMvA4gm
o/NFThMZdAH4Jtx1k+tOlkkSOqIRB6SrezbluJ1gWqJ453TF+fm1WSSnSgBThTBP
DmrMY/wHri3spctI74LXoZ4m2R62a2TyaXvd2cjLIlszx11Dv+oh4dd80WoFbzK4
pZ7Otcdg8N8V6Wo57yWWyCLk0jZcQun1d6sYmNN6g01cVAWDB5CKfSmE9ymFUHkp
20NQvJygl86Dbe5MABe3ax+433w6yQ5SanhlMfa+t7zELkFz7Gb+eYlNeGvJXH0n
Rru5K/yLAmwuOGSs+q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2leWQ12QCxxOnw==
-----END CERTIFICATE-----`
};
const server = http.createServer(options, function (request, response) {
request.addListener('end', function () {
//
// Serve files!
//
file.serve(request, response);
}).resume();
})
require('chokidar-socket-emitter')({app: server, path: 'build', relativeTo: 'build'})
server.listen(9082)