lib/routes.js
function loadRoute( app, method, route, piePath, fn, middleware ) {
    var middlewares = [];
    // If there is some middleware, load it
    if ( middleware ) {
        middlewares = fn.middlewares.map(
            function( middleware ) {
            return require(
                path.join( process.cwd(), 'middlewares', 'middlewares.js' )
            )[ middleware ];
        });

        // Also, let's not forget to change the function to call
        fn = fn.method;
    }

    // Then, load the route
    app[ method ]( route, middlewares, require(
        path.join( process.cwd(), 'pies', piePath, 'controller.js' )
    ) [ fn ] );
}
function loadRoute( app, method, route, piePath, fn, middleware ) {
    var middlewares = [];
    // If there is some middleware, load it
    if ( middleware ) {
        middlewares = fn.middlewares.map(
            function( middleware ) {
            return require(
                path.join( process.cwd(), 'middlewares', 'middlewares.js' )
            )[ middleware ];
        });

        // Also, let's not forget to change the function to call
        fn = fn.method;
    }

    // Then, load the route
    app[ method ]( route, middlewares, require(
        path.join( process.cwd(), 'pies', piePath, 'controller.js' )
    ) [ fn ] );
}
function loadRoute ( app , method , route , piePath , fn , middleware ) { var middlewares = [ ] ; // If there is some middleware, load it if ( middleware ) { middlewares = fn . middlewares . map ( function ( middleware ) { return require ( path . join ( process . cwd ( ) , 'middlewares' , 'middlewares.js' ) ) [ middleware ] ; } ) ; // Also, let's not forget to change the function to call fn = fn . method ; } // Then, load the route app [ method ] ( route , middlewares , require ( path . join ( process . cwd ( ) , 'pies' , piePath , 'controller.js' ) ) [ fn ] ) ; }
Load *one* route
Load * one * route