imrefazekas / connect-rest

Exceptionally featureful Restful web services middleware for connect node.js
MIT License
100 stars 29 forks source link

Get TypeError: cb is not a function #44

Open datapresso opened 5 years ago

datapresso commented 5 years ago

We are using connect-rest via express. We are not using connect directly and we noticed that the error cited in this issue title when we try to callback.

If we try to have "cb" below and it is always undefined and subsequent cb calls will result in the "cb is not a function".

    async function service( request, content, cb ){
        console.log( 'Received headers:' + JSON.stringify( request.headers ) )
        console.log( 'Received parameters:' + JSON.stringify( request.parameters ) )
        console.log( 'Received JSON object:' + JSON.stringify( content ) )
        console.log( 'cb:' + JSON.stringify(cb) )
        return 'ok'
    }
    rest.get( [ { path: '/shake', version: '>=2.0.0' }, { path: '/twist', version: '>=2.1.1' } ], service )