kahmali / meteor-restivus

REST APIs for the Best of Us! - A Meteor 0.9+ package for building REST APIs https://atmospherejs.com/nimble/restivus
MIT License
544 stars 117 forks source link

confuse whey Cannot read property 'authRequired' of undefined #278

Closed YY030913 closed 7 years ago

YY030913 commented 7 years ago

error:

TypeError: Cannot read property 'authRequired' of undefined
W20170619-11:29:52.369(8)? (STDERR)     at Route.share.Route.Route._authAccepted (packages/nimble_restivus/lib/route.coffee:168:16)
W20170619-11:29:52.370(8)? (STDERR)     at Route.share.Route.Route._callEndpoint (packages/nimble_restivus/lib/route.coffee:147:9)
W20170619-11:29:52.371(8)? (STDERR)     at packages/nimble_restivus/lib/route.coffee:59:33
W20170619-11:29:52.372(8)? (STDERR)     at packages/simple_json-routes/json-routes.js:76:1

rest.coffee

Api = new Restivus
    useDefaultAuth: true
    prettyJson: true
    enableCors: false
Api.addRoute 'customers', authRequired: true,
    get: -> 
        try
            console.log @queryParams
            users = Accounts.users.find(@queryParams).fetch()
            return users

        catch e
            return e