@less-is-more/less-js 1.4.10 → 1.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/router.js +9 -3
package/package.json
CHANGED
package/src/router.js
CHANGED
|
@@ -18,6 +18,8 @@ module.exports = class Router {
|
|
|
18
18
|
*/
|
|
19
19
|
static async route(targets, req, res, context) {
|
|
20
20
|
const startTime = new Date().getTime();
|
|
21
|
+
// 兼容非阿里云
|
|
22
|
+
await this._handleParams(req);
|
|
21
23
|
const { methodName, className } = this._getPath(req);
|
|
22
24
|
if (methodName) {
|
|
23
25
|
const controller = targets[className];
|
|
@@ -27,8 +29,6 @@ module.exports = class Router {
|
|
|
27
29
|
const method = controller[methodName];
|
|
28
30
|
if (method) {
|
|
29
31
|
try {
|
|
30
|
-
// 兼容非阿里云
|
|
31
|
-
await this._handleParams(req);
|
|
32
32
|
// before
|
|
33
33
|
if (targets.before) {
|
|
34
34
|
console.log("start before action");
|
|
@@ -61,7 +61,13 @@ module.exports = class Router {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
static _getPath(req) {
|
|
64
|
-
console.log(
|
|
64
|
+
console.log(
|
|
65
|
+
"path:",
|
|
66
|
+
req.method,
|
|
67
|
+
req.path,
|
|
68
|
+
req.headers["content-type"],
|
|
69
|
+
JSON.stringify(req.params)
|
|
70
|
+
);
|
|
65
71
|
const paths = req.path.split("/");
|
|
66
72
|
const className = paths.length > 2 ? "/" + paths[paths.length - 2] : "/";
|
|
67
73
|
const methodName = paths[paths.length - 1];
|