te.js 1.0.9 → 1.1.1
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/README.md +20 -1
- package/package.json +2 -2
- package/server/files/uploader.js +1 -1
- package/server/target.js +3 -12
- package/utils/auto-register.js +1 -1
package/README.md
CHANGED
|
@@ -1 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center" id="title">te.js (WIP)</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center"><img src="https://tejas-documentation.vercel.app/tejas-logo.svg" alt="project-image"></p>
|
|
4
|
+
|
|
5
|
+
<p id="description">A Node Framework For Powerful Backend Services</p>
|
|
6
|
+
|
|
7
|
+
<a href="https://tejas-documentation.vercel.app/"><h3>Documentation (WIP)</h3></a>
|
|
8
|
+
|
|
9
|
+
<h2>Planned Features</h2>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* Robust exception handling so that your app never dies even if you forget to catch it.
|
|
13
|
+
* Offers a powerful and flexible routing system that enables method-free and clean URL structures.
|
|
14
|
+
* Fully compatible with Express middlewares as well as the ability to build te.js middlewares.
|
|
15
|
+
* Built-in logger to log all the requests responses and errors to help you debug your application.
|
|
16
|
+
* Built-in GUI to manage your application environment variables view logs and run schedulers.
|
|
17
|
+
* Real-time insights into the performance health and usage of your application with built-in monitoring.
|
|
18
|
+
* Built in alerts via Email SMS or Slack to notify you of any exceptions and malformed requests.
|
|
19
|
+
* Highly configurable caching options to cache responses at different levels to improve performance.
|
|
20
|
+
* Protect your API from abuse and control the rate of requests that clients can make to your API.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "te.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A nodejs framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "te.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"formidable": "^3.5.1",
|
|
28
28
|
"mime": "^4.0.1",
|
|
29
29
|
"statuses": "^2.0.1",
|
|
30
|
-
"tej-env": "^1.0.
|
|
30
|
+
"tej-env": "^1.0.9",
|
|
31
31
|
"tej-logger": "^1.2.1"
|
|
32
32
|
},
|
|
33
33
|
"lint-staged": {
|
package/server/files/uploader.js
CHANGED
package/server/target.js
CHANGED
|
@@ -11,8 +11,6 @@ const isEndpointValid = (endpoint) => {
|
|
|
11
11
|
|
|
12
12
|
const isShootValid = (shoot) => typeof shoot === 'function';
|
|
13
13
|
|
|
14
|
-
const validMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
|
|
15
|
-
|
|
16
14
|
class Target {
|
|
17
15
|
constructor(base = '') {
|
|
18
16
|
this.base = base;
|
|
@@ -32,26 +30,19 @@ class Target {
|
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
register() {
|
|
35
|
-
let allowedMethods = validMethods;
|
|
36
33
|
let args = arguments;
|
|
37
34
|
if (!args) return;
|
|
38
35
|
|
|
39
|
-
if (validMethods.includes(args[0])) {
|
|
40
|
-
allowedMethods = [args[0]];
|
|
41
|
-
args = arguments[1];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
36
|
const endpoint = args[0];
|
|
45
|
-
const shoot = args[args.length - 1];
|
|
46
|
-
const middlewares = Array.from(args).slice(1, args.length - 1);
|
|
47
|
-
|
|
48
37
|
if (!isEndpointValid(endpoint)) return;
|
|
38
|
+
|
|
39
|
+
const shoot = args[args.length - 1];
|
|
49
40
|
if (!isShootValid(shoot)) return;
|
|
50
41
|
|
|
42
|
+
const middlewares = Array.from(args).slice(1, args.length - 1);
|
|
51
43
|
const validMiddlewares = middlewares.filter(isMiddlewareValid);
|
|
52
44
|
|
|
53
45
|
targetRegistry.targets.push({
|
|
54
|
-
allowedMethods: allowedMethods.length > 0 ? allowedMethods : validMethods,
|
|
55
46
|
endpoint: this.base + endpoint,
|
|
56
47
|
middlewares: this.targetMiddlewares.concat(validMiddlewares),
|
|
57
48
|
shoot,
|
package/utils/auto-register.js
CHANGED