AjobK / Seaqull

Seaqull programming blog
http://www.seaqull.com
3 stars 0 forks source link

[332] Backend HTTPS option #332

Open AjobK opened 3 years ago

AjobK commented 3 years ago

Current state The current back-end is unable to run on HTTPS. I did this in a different project in the following way:


if (SECURE == 'true') {
    const httpsServer = https.createServer({
        key: fs.readFileSync('/etc/letsencrypt/live/seaqull.com/privkey.pem'),
        cert: fs.readFileSync('/etc/letsencrypt/live/seaqull.com/fullchain.pem')
    }, app);

    httpsServer.listen(8080, () => {
        console.log('(Secure) HTTPS Server running on port 8080 :-)');
    })
} else {
    app.listen(8080, () => { console.log('(Insecure) HTTP Server running on port 8080 :-)')})
}

Expected state Depending on .env variables you either run the back-end on HTTPS or HTTP

TO DO

Necessities

316

Branch 332-backend-https