@atlantjs/backend 11.0.16 → 11.0.18
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/package.json +1 -1
- package/setup/index.d.ts +2 -1
- package/setup/index.js +6 -4
- package/setup/server/server.d.ts +2 -1
- package/setup/server/server.js +1 -0
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
package/setup/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Newable } from "@atlantjs/arch";
|
|
2
2
|
import { DatabaseConfigAbstract, DatabaseHelperAbstract, DatabaseLiteConfigAbstract } from "@atlantjs/database";
|
|
3
|
+
import express from "express";
|
|
3
4
|
import { interfaces } from "inversify";
|
|
4
5
|
interface ServerProps {
|
|
5
6
|
databases?: Array<{
|
|
@@ -8,6 +9,6 @@ interface ServerProps {
|
|
|
8
9
|
configs: Newable<DatabaseConfigAbstract | DatabaseLiteConfigAbstract>;
|
|
9
10
|
}>;
|
|
10
11
|
}
|
|
11
|
-
export declare function initialize(props: ServerProps):
|
|
12
|
+
export declare function initialize(props: ServerProps): Promise<express.Application | undefined>;
|
|
12
13
|
export declare function synthesizePaths(): void;
|
|
13
14
|
export {};
|
package/setup/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const signale_1 = __importDefault(require("signale"));
|
|
|
12
12
|
const verses_1 = require("../backend/stitch/verses");
|
|
13
13
|
const dependency_injections_1 = require("./dependency-injections");
|
|
14
14
|
const server_1 = require("./server/server");
|
|
15
|
-
function initialize(props) {
|
|
15
|
+
async function initialize(props) {
|
|
16
16
|
cfonts_1.default.say("ATLANTJS", {
|
|
17
17
|
font: "chrome",
|
|
18
18
|
align: "left",
|
|
@@ -24,7 +24,7 @@ function initialize(props) {
|
|
|
24
24
|
const tasks = new listr2_1.Listr([
|
|
25
25
|
{
|
|
26
26
|
title: "Loading modules...",
|
|
27
|
-
task: (
|
|
27
|
+
task: (_ctx, task) => {
|
|
28
28
|
for (const module of verses_1.LOAD_MODULES) {
|
|
29
29
|
require(`#/modules/${module}`);
|
|
30
30
|
}
|
|
@@ -43,17 +43,19 @@ function initialize(props) {
|
|
|
43
43
|
}),
|
|
44
44
|
]);
|
|
45
45
|
}
|
|
46
|
-
server_1.Server.initialize();
|
|
47
46
|
task.title = `Server started on port \x1b[1m${verses_1.APP_PORT}\x1b`;
|
|
47
|
+
ctx.server = server_1.Server.initialize();
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
]);
|
|
51
51
|
try {
|
|
52
|
-
tasks.run();
|
|
52
|
+
const executedTask = await tasks.run();
|
|
53
|
+
return executedTask.server;
|
|
53
54
|
}
|
|
54
55
|
catch (error) {
|
|
55
56
|
signale_1.default.error(`${error}`);
|
|
56
57
|
}
|
|
58
|
+
return Promise.reject(new Error("Failed to initialize the server."));
|
|
57
59
|
}
|
|
58
60
|
function synthesizePaths() {
|
|
59
61
|
const moduleAlias = require("module-alias");
|
package/setup/server/server.d.ts
CHANGED
package/setup/server/server.js
CHANGED
|
@@ -23,6 +23,7 @@ class Server {
|
|
|
23
23
|
Server.instance.use(default_error_handler_theta_1.DefaultErrorHandlerTheta.create());
|
|
24
24
|
(0, routing_controllers_1.useExpressServer)(Server.instance, Server.routingOptions);
|
|
25
25
|
Server.instance.listen(verses_1.APP_PORT);
|
|
26
|
+
return Server.instance;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
exports.Server = Server;
|