param-parse.js 451 Bytes
'use strict';
const _ = require('lodash');
const parameter = require(`${global.utils}/parameter`);

module.exports = (req, res, next) => {
    let param = req.params.pathQs;

    param = _.trimEnd(param, '.html');

    if (param) {
        const params = parameter.minPathToFullParam(param);

        if (Object.keys(params).length) {
            Object.assign(req.query, params);
            req.yoho.seoParse = true;
        }
    }

    next();
};