Import lists from json

This commit is contained in:
Jip Fr 2021-04-09 15:10:12 +02:00
parent 79fbbb917e
commit 754b9be789
2 changed files with 31 additions and 13 deletions

28
feature-lists.json Normal file
View File

@ -0,0 +1,28 @@
[
{
"title": "Thing",
"features": [
{
"name": "Feature A",
"checked": true
},
{
"name": "Feature B",
"checked": false
}
]
},
{
"title": "Another list",
"features": [
{
"name": "Some other A",
"checked": true
},
{
"name": "Feature B",
"checked": false
}
]
}
]

View File

@ -2,24 +2,14 @@ const getLocale = require('../../util/getLocale');
const { Router } = require('express');
const router = new Router();
const featureLists = require('../../feature-lists.json');
router.get('/', (req, res) => {
const tmpLocale = getLocale('US', 'en');
res.render('home', {
layout: 'main',
locale: tmpLocale,
featuredFeatureList: {
title: 'Thing',
features: [
{
name: 'Feature A',
checked: true
},
{
name: 'Feature B',
checked: false
}
]
}
featuredFeatureList: featureLists[0]
});
});