-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
46 lines (36 loc) · 1.35 KB
/
index.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
const express = require('express');
const fs = require( "fs" );
const app = express();
const bodyParser = require('body-parser');
const jsonParser = bodyParser.json();
const urlencodedParser = bodyParser.urlencoded({ extended: false });
const textParser = bodyParser.text({ type: 'text/html' });
const http = require('http');
const https = require('https');
const host = 'localhost';
const portHTTP = 5000;
// const host = '88.99.148.11';
// const portHTTP = 80;
// const portHTTPS = 443;
// const optionsHTTP = {
// key: fs.readFileSync("radiance.key"),
// cert: fs.readFileSync("radiance.crt")
// };
const server = http.createServer(app);
// const httpsserver = https.createServer(optionsHTTP, app);
// app.use ((req, res, next) => {if (req.secure) {next();} else {res.redirect('https://' + req.headers.host + req.url);}});
app.use(express.static('build'));
// app.set('views', './views');
// app.set('view engine', 'pug');
// app.get('/', function (req, res) {
// res.render('index', { });
// res.end(); // Write response
// console.log('get / route rendered view with locale:');
// });
server.listen(portHTTP, host, () => {
console.log('Radiance http server is running at http://localhost:3000');
});
// httpsserver.listen(portHTTPS, host, () => {
// console.log('Radiance https server is running');
// });
app.use(express.static('build'));