index.js 573 Bytes
/**
 * index controller
 * @author: 赵彪<bill.zhao@yoho.cn>
 * @date: 2016/05/03
 */

'use strict';

const headerModel = require('../../../doraemon/models/header');

exports.index = (req, res) => {
    headerModel.getHeaderData()
        .then(function(modelRes) {
            let response = JSON.parse(modelRes);
            let data = headerModel.getAllHeaderData(response.data);

            data.headerData.navbars[0].active = true;
            res.render('index', data);
        })
        .catch(function(err) {
            res.render('error', err);
        });
};