ultimate-express 2.0.9 → 2.0.10

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/src/index.js CHANGED
@@ -1,65 +1,65 @@
1
- /*
2
- Copyright 2024 dimden.dev
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- const uWS = require("uWebSockets.js");
18
- const Application = require("./application.js");
19
- const Router = require("./router.js");
20
- const middlewares = require("./middlewares.js");
21
- const Request = require("./request.js");
22
- const Response = require("./response.js");
23
-
24
- try {
25
- // disable Uwebsockets header
26
- uWS._cfg('999999990007');
27
- } catch (error) {}
28
-
29
- // converts router to a function and makes it callable
30
- Application.Router = function(options) {
31
- const router = new Router(options);
32
- const fn = function(req, res, next) {
33
- router._routeRequest(req, res, 0).then(routed => {
34
- if(!routed) {
35
- next();
36
- }
37
- });
38
- };
39
- Object.assign(fn, router);
40
- Object.setPrototypeOf(fn, Object.getPrototypeOf(router));
41
- return fn;
42
- }
43
-
44
- Application.request = Request.prototype;
45
- Application.response = Response.prototype;
46
-
47
- Application.static = middlewares.static;
48
-
49
- Application.json = middlewares.json;
50
- Application.urlencoded = middlewares.urlencoded;
51
- Application.text = middlewares.text;
52
- Application.raw = middlewares.raw;
53
-
54
- module.exports = Application;
55
-
56
- // re-export some named exports for compatibility
57
- exports.application = Application;
58
- exports.request = Request.prototype;
59
- exports.response = Response.prototype;
60
- exports.Router = Router;
61
- exports.json = middlewares.json;
62
- exports.raw = middlewares.raw;
63
- exports.static = middlewares.static;
64
- exports.text = middlewares.text;
65
- exports.urlencoded = middlewares.urlencoded;
1
+ /*
2
+ Copyright 2024 dimden.dev
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ const uWS = require("uWebSockets.js");
18
+ const Application = require("./application.js");
19
+ const Router = require("./router.js");
20
+ const middlewares = require("./middlewares.js");
21
+ const Request = require("./request.js");
22
+ const Response = require("./response.js");
23
+
24
+ try {
25
+ // disable Uwebsockets header
26
+ uWS._cfg('999999990007');
27
+ } catch (error) {}
28
+
29
+ // converts router to a function and makes it callable
30
+ Application.Router = function(options) {
31
+ const router = new Router(options);
32
+ const fn = function(req, res, next) {
33
+ router._routeRequest(req, res, 0).then(routed => {
34
+ if(!routed) {
35
+ next();
36
+ }
37
+ });
38
+ };
39
+ Object.assign(fn, router);
40
+ Object.setPrototypeOf(fn, Object.getPrototypeOf(router));
41
+ return fn;
42
+ }
43
+
44
+ Application.request = Request.prototype;
45
+ Application.response = Response.prototype;
46
+
47
+ Application.static = middlewares.static;
48
+
49
+ Application.json = middlewares.json;
50
+ Application.urlencoded = middlewares.urlencoded;
51
+ Application.text = middlewares.text;
52
+ Application.raw = middlewares.raw;
53
+
54
+ module.exports = Application;
55
+
56
+ // re-export some named exports for compatibility
57
+ exports.application = Application;
58
+ exports.request = Request.prototype;
59
+ exports.response = Response.prototype;
60
+ exports.Router = Router;
61
+ exports.json = middlewares.json;
62
+ exports.raw = middlewares.raw;
63
+ exports.static = middlewares.static;
64
+ exports.text = middlewares.text;
65
+ exports.urlencoded = middlewares.urlencoded;