22 lines
525 B
JavaScript
22 lines
525 B
JavaScript
|
const express = require('express');
|
||
|
|
||
|
const app = express();
|
||
|
const port = 3000;
|
||
|
|
||
|
const handlebars = require('express-handlebars');
|
||
|
app.engine('.hbs', handlebars.engine({
|
||
|
layoutsDir: __dirname + '/views/layouts',
|
||
|
defaultLayout: 'index',
|
||
|
extname: '.hbs',
|
||
|
partialsDir: __dirname + '/views/partials',
|
||
|
}));
|
||
|
app.set('view engine', '.hbs');
|
||
|
|
||
|
app.use(express.static('public'));
|
||
|
|
||
|
app.get('/', (req, res) => {
|
||
|
res.render('main', { layout: 'index' });
|
||
|
});
|
||
|
|
||
|
app.listen(port, () => console.log(`Running on ${port}`));
|