var fsx = require('fs-extra');
module.exports = {
    create: function(Models) {
        return function create(req, res, next) {
            var model_name = req.body.model_name;
            var model_content = req.body.model_content;
            Models[model_name].create(model_content, function(create_err, create_result) {
                Models[model_name].find({}, function(find_err, find_result) {
                    return res.send(find_result);
                });
            });
        };
    },
    findALL: function(Models) {
        return function findALL(req, res, next) {
            if (req.params.custom_query) {
                Models[req.params.custom_query].find({}, function(err, result) {
                    return res.send(result);
                });
            }
        };
    },
    jsdiff: function() {
        return function jsdiff(req, res, next) {
            var jsondiffpatch = require(process.cwd() + '/tool/jsondiffpatch.js');
            var result = jsondiffpatch(JSON.parse(req.body.a), JSON.parse(req.body.b));
            console.log(JSON.stringify(result, null, 2));
            return res.send(result);
        }
    },
    js2json: function() {
        return function jstojson(req, res, next) {
            var js2json = require(process.cwd() + '/tool/js2json.js');
            return js2json({
                raw: req.body.raw,
                callback: function(err, result) {
                    res.send(result);
                }
            });

        };
    },
    gender: function() {
        return function gender(req, res, next) {
            if (!!req.body.gender_list) {
                var gender_list = req.body.gender_list;
                fsx.outputJson(process.cwd() + '/document/gender_list.json', gender_list, function(err) {
                    if (err) console.error(err);
                    return res.send('gender ok');
                });
            }
        };
    }
};

@@ -1501,437 +1501,8 @@
 );%0A%0A
-        %7D;%0A    %7D,%0A    gender: function() %7B%0A        return function gender(req, res, next) %7B%0A            if (!!req.body.gender_list) %7B%0A                var gender_list = req.body.gender_list;%0A                fsx.outputJson(process.cwd() + '/document/gender_list.json', gender_list, function(err) %7B%0A                    if (err) console.error(err);%0A                    return res.send('gender ok');%0A                %7D);%0A            %7D%0A
     

Remove unused Function