express.io.js 2026.122.1019 → 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 +23 -11
- package/package.json +3 -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);
|
|
@@ -161,12 +164,22 @@ express.response = function (app, request, http_d) {
|
|
|
161
164
|
|
|
162
165
|
express.setup = async function (request, response, next) {
|
|
163
166
|
if ("db") {
|
|
164
|
-
if (this.config.db.driver === "json") {
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
+
if (this.config.db.driver === "json") request.db = new JSON.db ({dir: this.dir.db, 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);
|
|
167
169
|
}
|
|
168
170
|
if ("app:client") {
|
|
169
|
-
|
|
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
|
+
}
|
|
170
183
|
}
|
|
171
184
|
if (true) {
|
|
172
185
|
response.output.set ("language", "en");
|
|
@@ -177,16 +190,15 @@ express.setup = async function (request, response, next) {
|
|
|
177
190
|
if (false) response.output.set ("meta", {attribute: {name: "key", content: "value"}});
|
|
178
191
|
}
|
|
179
192
|
this.emit ("setup", request, response);
|
|
180
|
-
this.emit ("j_son:setup", request, response);
|
|
181
193
|
next ();
|
|
182
194
|
}
|
|
183
195
|
|
|
184
196
|
express.security = function (request, response, next) {
|
|
185
197
|
this.emit ("security", request, response);
|
|
186
198
|
if (request.error.length) {
|
|
187
|
-
if (request.error.includes ("forbidden")) response.error.forbidden ();
|
|
188
|
-
else if (request.error.includes ("found")) response.error.found ();
|
|
189
|
-
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 ();
|
|
190
202
|
}
|
|
191
203
|
next ();
|
|
192
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,6 +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
|
+
"node-appwrite": "^21.1.0"
|
|
26
27
|
}
|
|
27
28
|
}
|