const express = require('express');
const morgan = require('morgan');
const compression = require('compression');


const app = express();
const env = process.env.NODE_ENV || 'development';

app.locals.title = "Slava Pavlutin"
app.locals.themeColor = "#212128";
app.locals.lorem = lorem;

app.set('env', env);
app.set('view engine', 'pug');

app.use(morgan('dev'));
app.use('/css', express.static('public/css'));
app.use('/js', express.static('public/js'));
app.use('/img', express.static('public/img'));
app.use(compression());

app.get('/', (req, res) => {
  res.render('index');
});

app.get('/blog', (req, res) => {
  const title = generateTitle(app.locals.title, 'Blog');
  res.render('blog', {title});
});

app.get('/projects', (req, res) => {
  const title = generateTitle(app.locals.title, 'Projects');
  res.render('projects', {title});
});

if (app.get(env) === 'production') {
  app.listen(80);
} else {
  app.listen(8000);
}

function generateTitle(...pieces) {
  return pieces.join(' | ')
}

function lorem() {
  return "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis nisi, delectus perferendis distinctio adipisci harum, earum qui, sequi, ratione inventore eveniet impedit! Corporis maiores facere ducimus non eaque voluptatibus dolorem?";
}

@@ -883,29 +883,147 @@
 n') %7B%0A  
-app.listen(80
+const server = app.listen(process.env.PORT %7C%7C 8080, () =%3E %7B%0A    console.log(%60Server running on port $%7Bserver.address().port%7D%60);%0A  %7D
 );%0A%7D els

Change port number