forked from austintgriffith/burner-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
64 lines (52 loc) ยท 1.92 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
61
62
63
64
var fs = require('fs'),
http = require('http'),
https = require('https'),
express = require('express');
var path = require('path');
var port = 443;
var options = {
key: fs.readFileSync('./privkey.pem'),
cert: fs.readFileSync('./fullchain.pem'),
};
var app = express();
var server = https.createServer(options, app).listen(port, function(){
console.log("Express server listening on port " + port);
});
app.use(express.static('./build'))
app.get("/*", function (req, res) {
res.sendFile(path.join(__dirname, 'build/index.html'));
});
/*
var StaticServer = require('static-server');
var server = new StaticServer({
rootPath: 'public', // required, the root of the server file tree
port: 80, // required, the port to listen
name: 'burner-wallet', // optional, will set "X-Powered-by" HTTP header
host: '0.0.0.0', // optional, defaults to any interface
cors: '*', // optional, defaults to undefined
templates: {
index: 'index.html', // optional, defaults to 'index.html'
notFound: 'index.html' // optional, defaults to undefined
}
});
server.start(function () {
console.log('Server listening to', server.port);
});
server.on('request', function (req, res) {
// req.path is the URL resource (file name) from server.rootPath
// req.elapsedTime returns a string of the request's elapsed time
});
server.on('symbolicLink', function (link, file) {
// link is the source of the reference
// file is the link reference
console.log('File', link, 'is a link to', file);
});
server.on('response', function (req, res, err, file, stat) {
// res.status is the response status sent to the client
// res.headers are the headers sent
// err is any error message thrown
// file the file being served (may be null)
// stat the stat of the file being served (is null if file is null)
// NOTE: the response has already been sent at this point
});
*/