var express = require('express')
var router = express.Router()
var multer = require('multer')
var dateFormat = require('dateformat')

var db = require('../db')

var storage = multer.diskStorage({
  destination: function (request, file, callback) {
    callback(null, './public/images/blog')
  },
  filename: function (request, file, callback) {
    callback(null, file.originalname)
  }
})
var upload = multer({storage: storage})


router.get('/', function (req, res) {
  db.getUsers(req.app.get('connection'))
    .then(function (users) {
      res.render('index', { users: users })
    })
    .catch(function (err) {
      res.status(500).send('DATABASE ERROR: ' + err.message)
    })
})

module.exports = router

@@ -424,16 +424,57 @@
 rage%7D)%0A%0A
+// SITE STRUCTURE%0A%0A// Frontpage - URL - /
 %0Arouter.
@@ -516,12 +516,18 @@
 .get
-User
+RecentBlog
 s(re
@@ -555,18 +555,16 @@
 '))%0A
-  
   .then(
 func
@@ -563,80 +563,594 @@
 hen(
-function (users) %7B%0A      res.render('index', %7B users: users %7D)%0A    %7D
+(results) =%3E %7B%0A    const viewData = %7B%0A      blog: %5B%5D%0A    %7D%0A    for (var i = 0; i %3C results.length; i++) %7B%0A      const blogEntry = %7B%0A        title: results%5Bi%5D.title,%0A        published_date: dateFormat(results%5Bi%5D.published_date, 'mmmm dd yyyy'),%0A        image: results%5Bi%5D.image,%0A        summary: results%5Bi%5D.summary,%0A        first_name: results%5Bi%5D.first_name,%0A        last_name: results%5Bi%5D.last_name,%0A        profile_id: results%5Bi%5D.profile_id,%0A        tags: results%5Bi%5D.tags,%0A        slugs: results%5Bi%5D.slugs%7D%0A      viewData.blog.push(blogEntry)%0A    %7D%0A    res.render('index', viewData
 )%0A  
+%7D)%0A
   .c
@@ -1167,26 +1167,24 @@
 ion (err) %7B%0A
-  
     res.stat
@@ -1230,18 +1230,16 @@
 essage)%0A
-  
   %7D)%0A%7D)%0A

Add get route for frontpage