forked from barakyoresh/Home-Dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
executable file
·32 lines (26 loc) · 861 Bytes
/
Copy pathserver.js
File metadata and controls
executable file
·32 lines (26 loc) · 861 Bytes
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
var fs = require('fs');
var http = require('http');
var https = require('https');
var crypto = require('crypto');
var privateKey = fs.readFileSync('sslcert/key.pem').toString();
var certificate = fs.readFileSync('sslcert/cert.pem').toString();
var credentials = {
key: privateKey,
cert: certificate
};
var express = require('express');
var app = express();
// your express configuration here
app.use('/public', express.static(__dirname + '/public'));
app.get('/', function(req, res) {
res.sendFile(__dirname + '/index.html');
});
app.post('/login', function(req, res) {
console.log("got login with params:")
console.log(req)
res.json({auth : true})
});
var httpServer = http.createServer(app);
var httpsServer = https.createServer(credentials, app);
httpServer.listen(8080);
httpsServer.listen(8443);