Add async functions supports into <Method>.execute

This commit is contained in:
Nikiroy78 2022-11-02 11:36:47 +03:00 committed by GitHub
parent 35799245ed
commit 0f9ba4fc7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1327 additions and 1327 deletions

View File

@ -115,7 +115,7 @@ class Main {
contentType = 'unknown';
}
let result = this.methods[name].executeIntoExpressRouter(
let result = await this.methods[name].executeIntoExpressRouter(
this.methods[name].allowedMethods[methodId],
req.headers,
(contentType.indexOf('json') != -1) ? req.body : new Object(),

View File

@ -80,7 +80,7 @@ class Method {
this.MainObject = mainObject;
}
executeIntoExpressRouter (
async executeIntoExpressRouter (
currentMethod,
headers,
json,
@ -177,11 +177,11 @@ class Method {
throw this.MainObject.paramsError(required, additional);
}
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) {
let required = { missed : [], unsyntax : [] };
let additional = { missed : [], unsyntax : [] };
@ -254,7 +254,7 @@ class Method {
// 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) {

View File

@ -6,7 +6,7 @@
"express-fileupload": "^1.4.0"
},
"name": "njsbacker",
"version": "0.9.1",
"version": "0.9.2",
"description": "Module for easy developing back-end projects at express.js",
"main": "index.js",
"devDependencies": {},

View File

@ -170,7 +170,7 @@ After creating class you must create object of njsbacker.Method:
var exampleMethod = new ExampleMethod('example', '/example', {
text : {
required : true,
type : njsbacker.types.string,
type : backend.types.string,
min_length : 1,
max_length : 255
}