search.js
472 Bytes
/**
* 产品搜索 controller
* @author 陈轩 <xuan.chen@yoho.cn>
*/
'use strict';
const model = require('../models/search.js');
/* 搜索 页面 */
exports.index = (req, res) => {
const view = {
module: 'product',
page: 'search'
};
res.render('search', view);
};
/* 查询 产品列表 */
exports.fetchProducts = (req, res, next) => {
model.products(req.query)
.then(result => res.json(result))
.catch(next);
};