text: const express = require('express');
  const hbs = require('hbs');
  const fs = require('fs');
  
  const port = process.env.PORT || 3000;
  var app = express();
  
  hbs.registerPartials(__dirname + '/views/partials');
  app.set('view engine', 'hbs');
  
  app.use((req, res, next) => {
    var now = new Date().toString();  
    var log = `${now}: ${req.method} ${req.url}`;
    console.log(log);
    fs.appendFile('server.log', log + '\n')
    next();
  });
  
  //app.use((req, res, next) => {
  //  res.render('maintenance.hbs');
  //});
  
  app.use(express.static(__dirname + '/public'));
  
  hbs.registerHelper('getCurrentYear', () => {
    return new Date().getFullYear();
  });
  
  hbs.registerHelper('screamIt', (text) => {
    return text.toUpperCase();
  });
  
  app.get('/', (request, response) => {
    response.render('home.hbs', {
      pageTitle: 'Home Page',
      welcomeMessage: 'Welcome to my home page!'
    })
  });
  
  app.get('/projects', (req, res) => {
    res.render('projects.hbs', {
      pageTitle: 'My Projects'
    })
  });
  
  app.get('/about', (req, res) => {
    //res.send('About page');
    res.render('about.hbs', {
      pageTitle: 'About Page'
    });
  });
  
  app.get('/bad', (req, res) => {
    res.send({
      errorMessage: 'Error handling request'
    });
  });
  
  app.listen(port, () => {
    console.log(`Server is up on port ${port}`);
  });
  