lib/scaffoldHandler.js
function addTemplateRoute(server, scaffold) {
        server.get(scaffold.path, function (req, res, next) {
            const transomTemplate = server.registry.get(scaffold.templateHandler);
            const contentType = scaffold.contentType || 'text/html';

            const p = new Promise(function (resolve, reject) {
                // Push request headers and params into the data going to the template.
                const data = scaffold.data || {};
                data.headers = req.headers;
                data.params = req.params;

                resolve(transomTemplate.renderHtmlTemplate(scaffold.templateName, data));
            }).then(function (pageData) {
                res.setHeader('content-type', contentType);
                res.end(pageData);
                next(false); // false stops the chain.
            }).catch(function (err) {
                next(err);
            });
        });
    }
function addTemplateRoute(server, scaffold) {
        server.get(scaffold.path, function (req, res, next) {
            const transomTemplate = server.registry.get(scaffold.templateHandler);
            const contentType = scaffold.contentType || 'text/html';

            const p = new Promise(function (resolve, reject) {
                // Push request headers and params into the data going to the template.
                const data = scaffold.data || {};
                data.headers = req.headers;
                data.params = req.params;

                resolve(transomTemplate.renderHtmlTemplate(scaffold.templateName, data));
            }).then(function (pageData) {
                res.setHeader('content-type', contentType);
                res.end(pageData);
                next(false); // false stops the chain.
            }).catch(function (err) {
                next(err);
            });
        });
    }
function addTemplateRoute ( server , scaffold ) { server . get ( scaffold . path , function ( req , res , next ) { const transomTemplate = server . registry . get ( scaffold . templateHandler ) ; const contentType = scaffold . contentType || 'text/html' ; const p = new Promise ( function ( resolve , reject ) { // Push request headers and params into the data going to the template. const data = scaffold . data || { } ; data . headers = req . headers ; data . params = req . params ; resolve ( transomTemplate . renderHtmlTemplate ( scaffold . templateName , data ) ) ; } ) . then ( function ( pageData ) { res . setHeader ( 'content-type' , contentType ) ; res . end ( pageData ) ; next ( false ) ; // false stops the chain. } ) . catch ( function ( err ) { next ( err ) ; } ) ; } ) ; }
Add a GET route that is handled with a template.

@param {*} server - Restify server instance
@param {*} scaffold
Add a GET route that is handled with a template .