|
|
@ -9,7 +9,7 @@ class Xapi { |
|
|
|
|
|
|
|
|
|
|
|
constructor(args, mysqlPool, app) { |
|
|
|
constructor(args, mysqlPool, app) { |
|
|
|
|
|
|
|
|
|
|
|
this.sqlConfig = args; |
|
|
|
this.config = args; |
|
|
|
this.mysql = new Xsql(args, mysqlPool) |
|
|
|
this.mysql = new Xsql(args, mysqlPool) |
|
|
|
this.app = app; |
|
|
|
this.app = app; |
|
|
|
|
|
|
|
|
|
|
@ -174,17 +174,21 @@ class Xapi { |
|
|
|
/**************** END : setup routes for each table ****************/ |
|
|
|
/**************** END : setup routes for each table ****************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.sqlConfig.dynamic === 1) { |
|
|
|
if (this.config.dynamic === 1) { |
|
|
|
|
|
|
|
|
|
|
|
this.app.route('/dynamic*') |
|
|
|
this.app.route('/dynamic*') |
|
|
|
.post(this.asyncMiddleware(this.runQuery.bind(this))); |
|
|
|
.post(this.asyncMiddleware(this.runQuery.bind(this))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************** START : multer routes ****************/ |
|
|
|
|
|
|
|
this.app.post('/upload', this.upload.single('file'), this.uploadFile.bind(this)); |
|
|
|
|
|
|
|
this.app.post('/uploads', this.upload.array('files', 10), this.uploadFiles.bind(this)); |
|
|
|
|
|
|
|
this.app.get('/download', this.downloadFile.bind(this)); |
|
|
|
|
|
|
|
/**************** END : multer routes ****************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************** START : multer routes ****************/ |
|
|
|
|
|
|
|
this.app.post('/upload', this.upload.single('file'), this.uploadFile.bind(this)); |
|
|
|
|
|
|
|
this.app.post('/uploads', this.upload.array('files', 10), this.uploadFiles.bind(this)); |
|
|
|
|
|
|
|
this.app.get('/download', this.downloadFile.bind(this)); |
|
|
|
|
|
|
|
/**************** END : multer routes ****************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|