node-vk-bot-api
Advanced tools
Comparing version 2.4.9 to 2.4.10
@@ -15,4 +15,5 @@ { | ||
"ignoreDestructuring": true | ||
}] | ||
}], | ||
"no-multi-spaces": "off" | ||
} | ||
} |
@@ -19,5 +19,5 @@ const Koa = require('koa'); | ||
app.use(bodyParser); | ||
app.use(bodyParser()); | ||
app.use(router.routes()); | ||
app.listen(process.env.PORT); |
class Request { | ||
constructor(...args) { | ||
// if passed 3 args, than it's express (req, res, next) | ||
// else koa (ctx, next) | ||
if (args.length === 3) { | ||
this.request = args[0]; // req [express] | ||
this.response = args[1]; // res [express] | ||
this.request = args[0]; | ||
this.response = args[1]; | ||
} else { | ||
this.request = args[0].req; // req [koa] | ||
this.response = args[0].res; // res [koa] | ||
this.request = args[0].request; | ||
this.response = args[0].res; | ||
} | ||
@@ -17,3 +19,3 @@ } | ||
set body(body) { | ||
this.response.send(body); | ||
this.response.end(body); | ||
} | ||
@@ -20,0 +22,0 @@ } |
{ | ||
"name": "node-vk-bot-api", | ||
"version": "2.4.9", | ||
"version": "2.4.10", | ||
"description": "🤖 VK bot framework for Node.js, based on Bots Long Poll API and Callback API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -16,4 +16,5 @@ const sendRequestViaKoa = (ctx, middleware) => { | ||
req: { body }, | ||
request: { body }, | ||
res: { | ||
send: (body) => { | ||
end: (body) => { | ||
ctx.res.body = body; | ||
@@ -20,0 +21,0 @@ }, |
37417
920