website/index.js

33 lines
823 B
JavaScript

const express = require('express');
const sassMiddleware = require('node-sass-middleware');
const path = require('path');
const app = express();
const port = 3000;
// configure the Pug templating engine
app.set('views', './views');
app.set('view engine', 'pug');
// initialize SASS compiler middleware
app.use(sassMiddleware({
src: path.join(__dirname, 'public', 'stylesheets'),
dest: path.join(__dirname, 'public', 'stylesheets'),
indentedSyntax: true,
outputStyle: 'compressed',
prefix: '/static/stylesheets',
debug: true
}));
// serve static files
app.use('/static', express.static(path.join(__dirname, 'public')));
// Index GET route
app.get('/', (req, res) => {
res.render('index');
});
// start Express app
app.listen(port, () => {
console.log(`The Bit Goblin website is listening on port ${port}`);
});