1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 22:39:26 +00:00

Added handlebars equality helper

This commit is contained in:
2022-02-08 20:20:23 +00:00
parent ba59030870
commit 2c64ac3dd8
2 changed files with 9 additions and 1 deletions

4
app.js
View File

@@ -12,6 +12,7 @@ const serveStatic = require('serve-static');
// Import user defined modules
const DatabaseConnectionPool = require('./lib/DatabaseConnectionPool');
const hbsHelpers = require('./lib/handlebarsHelpers.js');
const importJSON = require('./lib/importJSON');
@@ -53,7 +54,8 @@ async function main() {
app.engine(
'hbs',
engine({
extname: '.hbs'
extname: '.hbs',
helpers: hbsHelpers
})
);
app.set('view engine', 'hbs');

6
lib/handlebarsHelpers.js Normal file
View File

@@ -0,0 +1,6 @@
const helpers = {};
helpers.eq = (arg1, arg2, options) =>
arg1 == arg2 ? options.fn(this) : options.inverse(this);
module.exports = helpers;