const express = require('express');
const app = express();
const port = 3000;

// load routes
var siteRoutes = require('./routes/site');

// load template engine
app.set('views', './views');
app.set('view engine', 'pug');

// logging middleware
app.use((req, res, next) => {
	console.log(`${req.method}: ${req.url}`);
	next();
});

// serve static files from the public/ directory
app.use(express.static('public'));

// register routes
app.get('/', siteRoutes.index);

// start the express.js server
app.listen(port, () => {
	console.log(`Server started at port ${port}`);
});
