express.io.js 2026.122.1345 → 2026.123.955
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/node_packages/express.js +22 -9
- package/package.json +2 -2
package/node_packages/express.js
CHANGED
|
@@ -21,9 +21,10 @@ class express {
|
|
|
21
21
|
this.host = this.config.host || "0.0.0.0";
|
|
22
22
|
this.port = this.config.port || process.env.PORT || 3000;
|
|
23
23
|
this.dir = {name: this.config.dir}
|
|
24
|
-
this.dir.src = $.path.join (this.dir.name, "src")
|
|
25
|
-
this.dir.db = $.path.join (this.dir.src, "db")
|
|
26
|
-
this.dir.theme = $.path.join (this.dir.src, "theme")
|
|
24
|
+
this.dir.src = $.path.join (this.dir.name, "src");
|
|
25
|
+
this.dir.db = $.path.join (this.dir.src, "db");
|
|
26
|
+
this.dir.theme = $.path.join (this.dir.src, "theme");
|
|
27
|
+
this.db = this.config.db || {}
|
|
27
28
|
Event.proto (this);
|
|
28
29
|
}
|
|
29
30
|
static (path = "public", option) {
|
|
@@ -81,6 +82,8 @@ class express {
|
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
express.db = function () {}
|
|
86
|
+
|
|
84
87
|
express.io = function (app, http_d) {
|
|
85
88
|
var request = express.request (app, http_d);
|
|
86
89
|
var response = express.response (app, request, http_d);
|
|
@@ -162,10 +165,21 @@ express.response = function (app, request, http_d) {
|
|
|
162
165
|
express.setup = async function (request, response, next) {
|
|
163
166
|
if ("db") {
|
|
164
167
|
if (this.config.db.driver === "json") request.db = new JSON.db ({dir: this.dir.db, collection: this.config.db.collection});
|
|
165
|
-
if (this.config.db.driver === "appwrite") request.db = new $.appwrite.db ({id: this.config.db.id, host: this.config.db.host, project: this.config.db.project, collection: this.config.db.collection});
|
|
168
|
+
if (this.config.db.driver === "appwrite") request.db = new $.appwrite.db ({id: this.config.db.id, host: this.config.db.host, project: this.config.db.project, collection: this.config.db.collection}, this.db.json);
|
|
166
169
|
}
|
|
167
170
|
if ("app:client") {
|
|
168
|
-
|
|
171
|
+
var reference;
|
|
172
|
+
request.app = (await request.db.select ("app").find ({host: request.url.host.name})).data.one ();
|
|
173
|
+
if (request.app) {
|
|
174
|
+
if (reference = request.app.reference) {
|
|
175
|
+
request.app = (await request.db.select ("app").find (reference)).data.one ();
|
|
176
|
+
request.app.reference = reference;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
request.error.push ("found");
|
|
181
|
+
return next ();
|
|
182
|
+
}
|
|
169
183
|
}
|
|
170
184
|
if (true) {
|
|
171
185
|
response.output.set ("language", "en");
|
|
@@ -176,16 +190,15 @@ express.setup = async function (request, response, next) {
|
|
|
176
190
|
if (false) response.output.set ("meta", {attribute: {name: "key", content: "value"}});
|
|
177
191
|
}
|
|
178
192
|
this.emit ("setup", request, response);
|
|
179
|
-
this.emit ("j_son:setup", request, response);
|
|
180
193
|
next ();
|
|
181
194
|
}
|
|
182
195
|
|
|
183
196
|
express.security = function (request, response, next) {
|
|
184
197
|
this.emit ("security", request, response);
|
|
185
198
|
if (request.error.length) {
|
|
186
|
-
if (request.error.includes ("forbidden")) response.error.forbidden ();
|
|
187
|
-
else if (request.error.includes ("found")) response.error.found ();
|
|
188
|
-
else response.error ();
|
|
199
|
+
if (request.error.includes ("forbidden")) return response.error.forbidden ();
|
|
200
|
+
else if (request.error.includes ("found")) return response.error.found ();
|
|
201
|
+
else return response.error ();
|
|
189
202
|
}
|
|
190
203
|
next ();
|
|
191
204
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express.io.js",
|
|
3
3
|
"description": "Hello World",
|
|
4
|
-
"version": "2026.
|
|
4
|
+
"version": "2026.123.955",
|
|
5
5
|
"author": "Seindi Rahmat Barus <xseindi@gmail.com>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Seindi Rahmat Barus <xseindi@gmail.com>"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"express": "^5.2.1",
|
|
25
|
-
"script.io.js": "^2026.
|
|
25
|
+
"script.io.js": "^2026.123.955",
|
|
26
26
|
"node-appwrite": "^21.1.0"
|
|
27
27
|
}
|
|
28
28
|
}
|