function render(viewName, layoutPath) {
    if (!layoutPath) {
        return function (req, res) {
            res.render(viewName);
        };
    }
    else {
        return function (req, res) {
            res.render(viewName, { layout: layoutPath });
        };
    }

}

module.exports = {
    render: render
};

@@ -37,35 +37,8 @@
 ) %7B%0A
-    if (!layoutPath) %7B%0A    
     
@@ -78,103 +78,81 @@
     
-    res.render(viewName);%0A        %7D;%0A    %7D%0A    else %7B%0A        return function (req, res) %7B%0A
+if (layoutPath) %7B%0A            res.locals.layout = layoutPath;%0A    
     
+%7D%0A%0A
     
@@ -178,52 +178,17 @@
 Name
-, %7B layout: layoutPath %7D
 );%0A    
- 
-   %7D;%0A    %7D%0A
+%7D;
 %0A%7D%0A%0A

Change implementation of `render` route