driver.js
function route() {
        configure()

        middlewares()

        for (let route of config.routes) {
            if (route.type === 'view')
                server[route.method](route.src, (req, res) => {
                    res.render(`${app.root}/views/${route.dest}.twig`, {})
                })

            if (route.type === 'controller') {
                let [path, method] = route.dest.split('::')

                let controller = function () {
                    if (!app.controllers)
                        return require(`${app.root}/controllers/${path.replace('.', '/')}`)(app)

                    if (path.split('.').length > 1)
                        return app.controllers[path.split('.')[0]][path.split('.')[1]]
                    else
                        return app.controllers[path]
                }()

                let func = wrapper(controller[method])
                if (!func)
                    app.drivers.logger.error('blockbase-express - wrapper', `Undefined function ${controller}${method}`)

                if (route.method === 'post' || route.method === 'put')
                    server[route.method](route.src, upload.any(), func)
                else
                    server[route.method](route.src, func)
            }
        }

        errors()
    }
function route() {
        configure()

        middlewares()

        for (let route of config.routes) {
            if (route.type === 'view')
                server[route.method](route.src, (req, res) => {
                    res.render(`${app.root}/views/${route.dest}.twig`, {})
                })

            if (route.type === 'controller') {
                let [path, method] = route.dest.split('::')

                let controller = function () {
                    if (!app.controllers)
                        return require(`${app.root}/controllers/${path.replace('.', '/')}`)(app)

                    if (path.split('.').length > 1)
                        return app.controllers[path.split('.')[0]][path.split('.')[1]]
                    else
                        return app.controllers[path]
                }()

                let func = wrapper(controller[method])
                if (!func)
                    app.drivers.logger.error('blockbase-express - wrapper', `Undefined function ${controller}${method}`)

                if (route.method === 'post' || route.method === 'put')
                    server[route.method](route.src, upload.any(), func)
                else
                    server[route.method](route.src, func)
            }
        }

        errors()
    }
function route ( ) { configure ( ) middlewares ( ) for ( let route of config . routes ) { if ( route . type === 'view' ) server [ route . method ] ( route . src , ( req , res ) => { res . render ( ` ${ app . root } ${ route . dest } ` , { } ) } ) if ( route . type === 'controller' ) { let [ path , method ] = route . dest . split ( '::' ) let controller = function ( ) { if ( ! app . controllers ) return require ( ` ${ app . root } ${ path . replace ( '.' , '/' ) } ` ) ( app ) if ( path . split ( '.' ) . length > 1 ) return app . controllers [ path . split ( '.' ) [ 0 ] ] [ path . split ( '.' ) [ 1 ] ] else return app . controllers [ path ] } ( ) let func = wrapper ( controller [ method ] ) if ( ! func ) app . drivers . logger . error ( 'blockbase-express - wrapper' , ` ${ controller } ${ method } ` ) if ( route . method === 'post' || route . method === 'put' ) server [ route . method ] ( route . src , upload . any ( ) , func ) else server [ route . method ] ( route . src , func ) } } errors ( ) }
Initialize the routes
Initialize the routes