testing hbs extension

This commit is contained in:
Bitcarrot
2021-10-04 20:55:14 -07:00
parent 992012fc35
commit a480d30bba
3 changed files with 6 additions and 5 deletions

View File

@@ -17,11 +17,11 @@ const zhcnjson = require('./locales/zh-cn.json');
const zhhkjson = require('./locales/zh-hk.json'); const zhhkjson = require('./locales/zh-hk.json');
const enjson = require('./locales/en.json'); const enjson = require('./locales/en.json');
app.set('view engine', 'html'); app.set('view engine', 'hbs');
app.engine('html', handlebars({ app.engine('hbs', handlebars({
layoutsDir: __dirname + '/views/layouts', layoutsDir: __dirname + '/views/layouts',
extname: 'html', extname: 'hbs',
})); }));
//Serves static files (we need it to import a css file) //Serves static files (we need it to import a css file)
@@ -55,7 +55,8 @@ app.use(express.static(path.join(__dirname, 'public', 'css')));
app.use(express.json({ extended: false })); app.use(express.json({ extended: false }));
app.get('/', function(req, res) { app.get('/', function(req, res) {
res.redirect('/en'); res.render('test', enjson)
// res.redirect('/en');
//res.render('index', { layout: 'main' }); //res.render('index', { layout: 'main' });
}); });