forked from mjwood-1975/vanilla-sudoku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
21 lines (18 loc) · 762 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const fs = require('fs')
const express = require('express')
const app = express()
const https = require('https')
const privateKey = fs.readFileSync( '/etc/letsencrypt/live/vanilla-sudoku.com/privkey.pem')
const certificate = fs.readFileSync( '/etc/letsencrypt/live/vanilla-sudoku.com/cert.pem' )
const port = 443
app.use((req, res, next) => { console.log(`${new Date().toUTCString()} ${req.method} ${req.path} ${req.ip}`); next() })
app.use((error, req, res, next) => { console.log(`log error stuff ${req.path}`); next() })
app.use(express.static('static'))
app.use('/static', express.static('static'))
app.all('*', (req, res) => {
res.status(404).send("Not Found")
})
https.createServer({
key: privateKey,
cert: certificate,
}, app).listen(port)