Skip to content

Instantly share code, notes, and snippets.

@indigokidsgames
Last active August 24, 2017 15:36
Show Gist options
  • Save indigokidsgames/e11ab7626837c0ecba79648202229fe8 to your computer and use it in GitHub Desktop.
Save indigokidsgames/e11ab7626837c0ecba79648202229fe8 to your computer and use it in GitHub Desktop.
Feathers-mongodb bug
const adapter = require('feathers-mongodb')
const feathers = require('feathers')
class Service extends adapter.Service {
constructor (options) {
super(options)
this.addedInConstructor = 'foo'
setTimeout(() => this.testFn(), 3000)
}
setup (app) {
this.app = app
console.log('setup. app: %s, constructor: %s', !!this.app, !!this.addedInConstructor)
console.log(this.__proto__)
}
testFn () {
console.log('testFn. app: %s, constructor: %s', !!this.app, !!this.addedInConstructor)
console.log(this.__proto__)
}
}
const app = feathers()
const options = {}
app.use('/test', new Service(options))
app.listen(12345)
@indigokidsgames
Copy link
Author

Actual result:

setup. app: true, constructor: true
{ create: null }
testFn. app: false, constructor: true
Service {}

Expected:

setup. app: true, constructor: true
Service {}
testFn. app: true, constructor: true
Service {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment