You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
var express = require('express');
|
|
var router = express.Router();
|
|
var Models = require('../../models');
|
|
var config = require('../../../config.json');
|
|
router.get('/', function(req, res) {
|
|
Models.FolioProject.findAll({order:[['sortIndex', 'DESC']]}).then(projects=> {
|
|
res.render(config.theme+'/work', {
|
|
theme: config.theme,
|
|
title: 'The Twelfth House | Creative Works and Projects',
|
|
projects: projects,
|
|
mode: 'projects'
|
|
});
|
|
}).then(function(value) {
|
|
//console.log(value);
|
|
}).catch(function(err) {
|
|
//next(err);
|
|
})
|
|
});
|
|
|
|
router.get('/:id', function(req, res) {
|
|
Models.FolioProject.findOne({where:{slug: req.params.id}}).then((project) => {
|
|
res.render(config.theme+'/work-project', {
|
|
title: project.title,
|
|
type: project.type,
|
|
desc: project.description,
|
|
images: JSON.parse(project.images),
|
|
mode:'folio',
|
|
url:project.url
|
|
});
|
|
|
|
}).catch((err) => {
|
|
console.log(err);
|
|
});
|
|
});
|
|
|
|
|
|
module.exports = router;
|