nodester 0.3.1 → 0.3.3
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/lib/router/index.js
CHANGED
|
@@ -140,6 +140,15 @@ module.exports = class NodesterRouter {
|
|
|
140
140
|
|
|
141
141
|
// Getters:
|
|
142
142
|
|
|
143
|
+
/**
|
|
144
|
+
* @return {Map} controllers
|
|
145
|
+
*
|
|
146
|
+
* @access public
|
|
147
|
+
*/
|
|
148
|
+
get controllers() {
|
|
149
|
+
return this._controllers;
|
|
150
|
+
}
|
|
151
|
+
|
|
143
152
|
/**
|
|
144
153
|
* @return {MiddlewaresStack}
|
|
145
154
|
*
|
|
@@ -149,6 +158,15 @@ module.exports = class NodesterRouter {
|
|
|
149
158
|
return this._middlewares;
|
|
150
159
|
}
|
|
151
160
|
|
|
161
|
+
/**
|
|
162
|
+
* @return {Map} providers
|
|
163
|
+
*
|
|
164
|
+
* @access public
|
|
165
|
+
*/
|
|
166
|
+
get providers() {
|
|
167
|
+
return this._providers;
|
|
168
|
+
}
|
|
169
|
+
|
|
152
170
|
/**
|
|
153
171
|
* Indicates whether user can add more middlewares or not.
|
|
154
172
|
*
|
|
@@ -38,6 +38,8 @@ function _validateParsedRouteMethood(parsedRoute) {
|
|
|
38
38
|
* @access public
|
|
39
39
|
*/
|
|
40
40
|
function _wrapRouteHandler(routeInstance, handler) {
|
|
41
|
+
const router = this;
|
|
42
|
+
|
|
41
43
|
const handlerType = typeOf(handler);
|
|
42
44
|
|
|
43
45
|
let parsedHandler = null;
|
|
@@ -78,6 +80,12 @@ function _wrapRouteHandler(routeInstance, handler) {
|
|
|
78
80
|
return next();
|
|
79
81
|
}
|
|
80
82
|
|
|
83
|
+
// Store info about current route in request.
|
|
84
|
+
req._routing = {
|
|
85
|
+
route,
|
|
86
|
+
router
|
|
87
|
+
}
|
|
88
|
+
|
|
81
89
|
// Populate params.
|
|
82
90
|
req.params = routeInstance.params;
|
|
83
91
|
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
module.exports = {
|
|
10
10
|
NUMBER: _NUMBER,
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
INT: _INTEGER,
|
|
13
|
+
INTEGER: _INTEGER,
|
|
14
|
+
|
|
12
15
|
BOOLEAN: _BOOLEAN,
|
|
13
16
|
STRING: _STRING,
|
|
14
17
|
|
|
@@ -39,7 +42,7 @@ function _NUMBER(value=undefined, options={ fallback:undefined, min:undefined, m
|
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
function
|
|
45
|
+
function _INTEGER(value=undefined, options={ fallback:undefined, min:undefined, max:undefined }) {
|
|
43
46
|
const num = _NUMBER(value, { fallback:undefined, min:options?.min, max:options?.max });
|
|
44
47
|
return num === undefined ? options?.fallback : parseInt(num);
|
|
45
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodester",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "A versatile REST framework for Node.js",
|
|
5
5
|
"directories": {
|
|
6
6
|
"docs": "docs",
|
|
@@ -107,8 +107,7 @@
|
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|
|
109
109
|
"lint": "eslint .",
|
|
110
|
-
"test": "jest"
|
|
111
|
-
"publish": "npm run lint && npm publish"
|
|
110
|
+
"test": "jest"
|
|
112
111
|
},
|
|
113
112
|
"author": "Mark Khramko <markkhramko@gmail.com>",
|
|
114
113
|
"license": "MIT",
|