website/index.js

27 lines
580 B
JavaScript

const express = require('express');
const path = require('path');
const app = express();
const port = 3000;
// configure the Pug templating engine
app.set('views', './views');
app.set('view engine', 'pug');
// serve static files
app.use('/static', express.static(path.join(__dirname, 'public')));
// Index GET route
app.get('/', (req, res) => {
res.render('index');
});
// Test GET route
app.get('/test', (req, res) => {
res.send('This is a test.');
});
// start Express app
app.listen(port, () => {
console.log(`The Bit Goblin website is listening on port ${port}`);
});