lib/generators.js
function generateRouter(path, modelName, generateMethod, ts, cb) {
    var extension = (ts) ? 'ts' : 'js';
    var router = ft.loadTemplateSync('router.' + extension);
    router = router.replace(/{controllerName}/g, modelName + 'Controller');

    if (generateMethod === 't') {
        ft.createDirIfIsNotDefined(path, 'routes', function () {
            router = router.replace(/{controllerPath}/g, '\'../controllers/' + modelName + 'Controller.' + extension + '\'');
            ft.writeFile(path + '/routes/' + modelName + 'Routes.' + extension, router, null, cb);
        });
    } else {
        ft.createDirIfIsNotDefined(path, modelName, function () {
            router = router.replace(/{controllerPath}/g, '\'./' + modelName + 'Controller.' + extension + '\'');
            ft.writeFile(path + '/' + modelName + '/' + modelName + 'Routes.' + extension, router, null, cb);
        });
    }
}
function generateRouter(path, modelName, generateMethod, ts, cb) {
    var extension = (ts) ? 'ts' : 'js';
    var router = ft.loadTemplateSync('router.' + extension);
    router = router.replace(/{controllerName}/g, modelName + 'Controller');

    if (generateMethod === 't') {
        ft.createDirIfIsNotDefined(path, 'routes', function () {
            router = router.replace(/{controllerPath}/g, '\'../controllers/' + modelName + 'Controller.' + extension + '\'');
            ft.writeFile(path + '/routes/' + modelName + 'Routes.' + extension, router, null, cb);
        });
    } else {
        ft.createDirIfIsNotDefined(path, modelName, function () {
            router = router.replace(/{controllerPath}/g, '\'./' + modelName + 'Controller.' + extension + '\'');
            ft.writeFile(path + '/' + modelName + '/' + modelName + 'Routes.' + extension, router, null, cb);
        });
    }
}
function generateRouter ( path , modelName , generateMethod , ts , cb ) { var extension = ( ts ) ? 'ts' : 'js' ; var router = ft . loadTemplateSync ( 'router.' + extension ) ; router = router . replace ( / {controllerName} / g , modelName + 'Controller' ) ; if ( generateMethod === 't' ) { ft . createDirIfIsNotDefined ( path , 'routes' , function ( ) { router = router . replace ( / {controllerPath} / g , '\'../controllers/' + modelName + 'Controller.' + extension + '\'' ) ; ft . writeFile ( path + '/routes/' + modelName + 'Routes.' + extension , router , null , cb ) ; } ) ; } else { ft . createDirIfIsNotDefined ( path , modelName , function ( ) { router = router . replace ( / {controllerPath} / g , '\'./' + modelName + 'Controller.' + extension + '\'' ) ; ft . writeFile ( path + '/' + modelName + '/' + modelName + 'Routes.' + extension , router , null , cb ) ; } ) ; } }
Generate a Express router
@param {string} path
@param {string} modelName
@param {string} generateMethod
@param {boolean} ts generating code in TS
@param {function} cb
Generate a Express router