2022-02-19 01:03:46 -05:00
|
|
|
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
|
2022-02-19 12:05:13 -05:00
|
|
|
app.use('/assets', express.static(path.join(__dirname, 'public')));
|
2022-02-19 01:03:46 -05:00
|
|
|
|
|
|
|
// Index GET route
|
|
|
|
app.get('/', (req, res) => {
|
|
|
|
res.render('index');
|
|
|
|
});
|
|
|
|
|
2022-02-19 01:13:53 -05:00
|
|
|
// Test GET route
|
|
|
|
app.get('/test', (req, res) => {
|
|
|
|
res.send('This is a test.');
|
|
|
|
});
|
|
|
|
|
2022-02-19 01:03:46 -05:00
|
|
|
// start Express app
|
|
|
|
app.listen(port, () => {
|
|
|
|
console.log(`The Bit Goblin website is listening on port ${port}`);
|
|
|
|
});
|