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.
Fipamo/brain/routes/front/index.js

66 lines
2.0 KiB
JavaScript

var express = require('express');
var router = express.Router();
var Models = require('../../models');
var config = require('../../../site-settings.json');
module.exports = function (session) {
//--------------------------
// Index
//--------------------------
router.get('/:page?', function (req, res) {
if (req.params.page == null || req.params.page == "") {
Models.FolioProject.findAll({
limit: 5,
order: [
['id', 'DESC']
]
}).then(entries => {
Models.Post.findAll({
limit: 5,
order: [
['id', 'DESC']
]
}).then(posts => {
Models.Bookmark.findAll({
limit: 5,
order: [
['id', 'DESC']
]
}).then(saved => {
res.render(config.theme + '/index', {
theme: config.theme,
title: 'The Twelfth House | Home of creative technologist, beat maker and over-thinker, Ro',
user_status: "What up, random person",
mode: 'index',
folio: entries,
posts: posts,
bookmarks: saved
});
}).catch(err => {
console.log(err);
})
})
}).then(function (value) {
//console.log(value);
}).catch(function (err) {
console.log(err);
})
} else {
switch (req.params.page) {
case "dashboard":
console.log('here')
break;
default:
console.log(req.params.page)
break;
}
}
});
return router;
}