Add async functions supports into <Method>.execute
This commit is contained in:
parent
35799245ed
commit
0f9ba4fc7b
@ -115,7 +115,7 @@ class Main {
|
|||||||
contentType = 'unknown';
|
contentType = 'unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = this.methods[name].executeIntoExpressRouter(
|
let result = await this.methods[name].executeIntoExpressRouter(
|
||||||
this.methods[name].allowedMethods[methodId],
|
this.methods[name].allowedMethods[methodId],
|
||||||
req.headers,
|
req.headers,
|
||||||
(contentType.indexOf('json') != -1) ? req.body : new Object(),
|
(contentType.indexOf('json') != -1) ? req.body : new Object(),
|
||||||
|
@ -80,7 +80,7 @@ class Method {
|
|||||||
this.MainObject = mainObject;
|
this.MainObject = mainObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
executeIntoExpressRouter (
|
async executeIntoExpressRouter (
|
||||||
currentMethod,
|
currentMethod,
|
||||||
headers,
|
headers,
|
||||||
json,
|
json,
|
||||||
@ -177,11 +177,11 @@ class Method {
|
|||||||
throw this.MainObject.paramsError(required, additional);
|
throw this.MainObject.paramsError(required, additional);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return this.pre_execute(paramsEndless, false);
|
return await this.pre_execute(paramsEndless, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pre_execute (params, needsChecking = true) {
|
async pre_execute (params, needsChecking = true) {
|
||||||
if (needsChecking) {
|
if (needsChecking) {
|
||||||
let required = { missed : [], unsyntax : [] };
|
let required = { missed : [], unsyntax : [] };
|
||||||
let additional = { missed : [], unsyntax : [] };
|
let additional = { missed : [], unsyntax : [] };
|
||||||
@ -254,7 +254,7 @@ class Method {
|
|||||||
// for (let key in sessionData) { params[key] = sessionData[key]; }
|
// for (let key in sessionData) { params[key] = sessionData[key]; }
|
||||||
// Исполнение группы
|
// Исполнение группы
|
||||||
|
|
||||||
return this.execute(params, sessionData, groupData._getValues());
|
return await this.execute(params, sessionData, groupData._getValues());
|
||||||
}
|
}
|
||||||
|
|
||||||
group (group) {
|
group (group) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"express-fileupload": "^1.4.0"
|
"express-fileupload": "^1.4.0"
|
||||||
},
|
},
|
||||||
"name": "njsbacker",
|
"name": "njsbacker",
|
||||||
"version": "0.9.1",
|
"version": "0.9.2",
|
||||||
"description": "Module for easy developing back-end projects at express.js",
|
"description": "Module for easy developing back-end projects at express.js",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
|
@ -170,7 +170,7 @@ After creating class you must create object of njsbacker.Method:
|
|||||||
var exampleMethod = new ExampleMethod('example', '/example', {
|
var exampleMethod = new ExampleMethod('example', '/example', {
|
||||||
text : {
|
text : {
|
||||||
required : true,
|
required : true,
|
||||||
type : njsbacker.types.string,
|
type : backend.types.string,
|
||||||
min_length : 1,
|
min_length : 1,
|
||||||
max_length : 255
|
max_length : 255
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user