core/api/index.js
function (req, res, dataPath) {
    var body = req.body;
    var data = body.data;
    var dataUnflatten = body.unflatten;

    if (dataUnflatten) {
        data = unflatten(data, { delimiter: '/', overwrite: 'root' });
    }

    htmlTree.writeDataFile(data, true, dataPath, function(err, finalData){
        if (err || !finalData) {
            res.status(config.statusCodes.error).json({
                message: err
            });
        } else {
            res.status(config.statusCodes.OK).json(finalData);
        }
    });
}
function (req, res, dataPath) {
    var body = req.body;
    var data = body.data;
    var dataUnflatten = body.unflatten;

    if (dataUnflatten) {
        data = unflatten(data, { delimiter: '/', overwrite: 'root' });
    }

    htmlTree.writeDataFile(data, true, dataPath, function(err, finalData){
        if (err || !finalData) {
            res.status(config.statusCodes.error).json({
                message: err
            });
        } else {
            res.status(config.statusCodes.OK).json(finalData);
        }
    });
}
function ( req , res , dataPath ) { var body = req . body ; var data = body . data ; var dataUnflatten = body . unflatten ; if ( dataUnflatten ) { data = unflatten ( data , { delimiter : '/' , overwrite : 'root' } ) ; } htmlTree . writeDataFile ( data , true , dataPath , function ( err , finalData ) { if ( err || ! finalData ) { res . status ( config . statusCodes . error ) . json ( { message : err } ) ; } else { res . status ( config . statusCodes . OK ) . json ( finalData ) ; } } ) ; }
postHTML REST api processor

@param {Object} req - express request
@param {Object} req.body.data - data to write
@param {Boolean} req.body.unflatten - set true, to unflat tree from 'base/spec'

@param {Object} res - express response
@param {String} dataPath - custom data storage path

Writes result to res object
postHTML REST api processor