@anteros/core 0.0.11 → 0.0.13
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/database/collection.ts +1 -1
- package/database/file.ts +1 -1
- package/database/tenant.ts +1 -1
- package/package.json +1 -1
- package/server/boot.ts +1 -1
- package/server/routes.ts +18 -3
- package/types/route.d.ts +2 -2
package/database/collection.ts
CHANGED
package/database/file.ts
CHANGED
package/database/tenant.ts
CHANGED
package/package.json
CHANGED
package/server/boot.ts
CHANGED
|
@@ -91,7 +91,7 @@ async function bootApp(options: BootAppOptions = {} as BootAppOptions) {
|
|
|
91
91
|
|
|
92
92
|
return server;
|
|
93
93
|
} catch (err: any) {
|
|
94
|
-
console.error('Failed to boot server', err?.message);
|
|
94
|
+
console.error('Failed to boot server', cfg.debug ? err : err?.message);
|
|
95
95
|
process.exit(1);
|
|
96
96
|
}
|
|
97
97
|
}
|
package/server/routes.ts
CHANGED
|
@@ -9,8 +9,10 @@ import type { HonoVariables } from "./env";
|
|
|
9
9
|
function initializeRoutes(app: Hono<{ Variables: HonoVariables }>) {
|
|
10
10
|
for (let route of cfg.routes ?? []) {
|
|
11
11
|
if (route._prefix_) {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
let method = route.method.toLocaleLowerCase();
|
|
13
|
+
let routePath = path.posix.join(route._prefix_, route.path);
|
|
14
|
+
|
|
15
|
+
|
|
14
16
|
|
|
15
17
|
if (route.method == "GET") {
|
|
16
18
|
app.get(routePath, async (c) => { //
|
|
@@ -37,6 +39,19 @@ function initializeRoutes(app: Hono<{ Variables: HonoVariables }>) {
|
|
|
37
39
|
});
|
|
38
40
|
});
|
|
39
41
|
}
|
|
42
|
+
|
|
43
|
+
if (route.method == "PUT") {
|
|
44
|
+
app.put(routePath, async (c) => { //
|
|
45
|
+
return route.handler({
|
|
46
|
+
c,
|
|
47
|
+
rest: new useRest({
|
|
48
|
+
tenant_id: route._tenant_,
|
|
49
|
+
}),
|
|
50
|
+
jwt: jwt,
|
|
51
|
+
io: io,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
40
55
|
}
|
|
41
56
|
}
|
|
42
57
|
|
|
@@ -45,4 +60,4 @@ function initializeRoutes(app: Hono<{ Variables: HonoVariables }>) {
|
|
|
45
60
|
|
|
46
61
|
export {
|
|
47
62
|
initializeRoutes
|
|
48
|
-
}
|
|
63
|
+
}
|
package/types/route.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ type routeContext = {
|
|
|
11
11
|
type Route = {
|
|
12
12
|
enabled?: boolean;
|
|
13
13
|
path: string;
|
|
14
|
-
method: 'GET' | 'POST';
|
|
14
|
+
method: 'GET' | 'POST'|'PUT';
|
|
15
15
|
handler: (ctx: routeContext) => void;
|
|
16
16
|
_tenant_?: string;
|
|
17
17
|
_isRoute_?: boolean;
|
|
18
18
|
_prefix_?: string;
|
|
19
|
-
}
|
|
19
|
+
}
|