-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (26 loc) · 838 Bytes
/
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
const express = require('express')
const fs = require('fs')
const https = require('https')
const session = require('express-session')
const privatekey = fs.readFileSync(__dirname + '/sslcert/key.pem')
const certificate = fs.readFileSync(__dirname + '/sslcert/cert.pem')
const app = express()
app.set('view engine', 'ejs')
app.use(express.urlencoded({ extended:false}))
app.use(express.json())
app.use(express.static(__dirname + '/static'))
app.use(session({
secret: 'soverysecurecookie',
resave: 'false',
saveUninitialized: 'false',
secure: 'true'
}))
require('./route/routing.js')(app)
app.use((err, req, res, next) => {
res.end('Problem...');
console.log(err);
});
const server = https.createServer({key: privatekey, cert: certificate}, app)
server.listen(3000, () => {
console.log("On: 3000")
})