website/index.js

38 lines
909 B
JavaScript
Raw Normal View History

2022-02-19 01:03:46 -05:00
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');
});
// 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}`);
});