Adding autobind decorator to server
This commit is contained in:
@@ -5,7 +5,7 @@ import createError from 'http-errors'
|
||||
import path from 'path'
|
||||
import util from 'util'
|
||||
import config from 'config'
|
||||
import autoBind from 'auto-bind2'
|
||||
import autobind from 'autobind-decorator'
|
||||
|
||||
function pipeToGridFS(readable, gfsWriteable) {
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
@@ -23,6 +23,7 @@ function pipeToGridFS(readable, gfsWriteable) {
|
||||
return promise
|
||||
}
|
||||
|
||||
@autobind
|
||||
export class AssetRoutes {
|
||||
static rangeRegex = /^byte (\d+)/
|
||||
|
||||
@@ -32,7 +33,6 @@ export class AssetRoutes {
|
||||
this.db = container.db
|
||||
this.rs = container.rs
|
||||
this.uploadTimeout = config.get('api.uploadTimout')
|
||||
autoBind(this)
|
||||
app.route('/assets/:_id')
|
||||
.get(passport.authenticate('bearer', { session: false }), this.getAsset)
|
||||
.delete(passport.authenticate('bearer', { session: false }), this.deleteAsset)
|
||||
|
||||
Reference in New Issue
Block a user