Skip to content

Commit

Permalink
Support https, update vulnerable packages
Browse files Browse the repository at this point in the history
  • Loading branch information
demipixel committed Dec 5, 2018
1 parent 70994cc commit ef0325a
Show file tree
Hide file tree
Showing 3 changed files with 994 additions and 660 deletions.
13 changes: 11 additions & 2 deletions app.js
Expand Up @@ -2,6 +2,9 @@ const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const cookieParser = require('cookie-parser');
const http = require('http');
const https = require('https');
const fs = require('fs');


const PORT = process.env.NODE_ENV != 'production' ? 5000 : 80;
Expand All @@ -22,8 +25,14 @@ app.use(bodyParser.urlencoded({

app.use(cookieParser());

const server = app.listen(PORT, () => {
console.log('Server live on port ' + server.address().port);
const certPath = '/etc/letsencrypt/live/autotorio.com/fullchain.pem';
const keyPath = '/etc/letsencrypt/live/autotorio.com/privkey.pem';

const server = (process.env.NODE_ENV == 'production' ? https.createServer({
cert: fs.existsSync(certPath) ? fs.readFileSync(certPath) : undefined,
key: fs.existsSync(keyPath) ? fs.readFileSync(keyPath) : undefined
}) : http.createServer(app)).listen(PORT, () => {
console.log('Server live on port ' + PORT);
});

require('./router')(app);

0 comments on commit ef0325a

Please sign in to comment.