@ccci/micro-server 0.0.39 → 1.0.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/dist/index.js
CHANGED
|
@@ -87763,7 +87763,7 @@ class RouterFactory {
|
|
|
87763
87763
|
|
|
87764
87764
|
// src/utils/ApplicationServer.ts
|
|
87765
87765
|
class ApplicationServer {
|
|
87766
|
-
static async bootstrap(
|
|
87766
|
+
static async bootstrap(port, options) {
|
|
87767
87767
|
const app = import_express.default();
|
|
87768
87768
|
Logger.info("Setting up application middlewares...\n");
|
|
87769
87769
|
app.use(import_cors.default());
|
|
@@ -87771,12 +87771,12 @@ class ApplicationServer {
|
|
|
87771
87771
|
app.use(import_express.default.json());
|
|
87772
87772
|
app.use(import_express_fileupload.default());
|
|
87773
87773
|
Logger.info("Initializing DB Connection...\n");
|
|
87774
|
-
const db = new DatabaseConnector(
|
|
87774
|
+
const db = new DatabaseConnector(process.cwd());
|
|
87775
87775
|
const conn = await DatabaseConnector.init();
|
|
87776
87776
|
await db.connect(conn[0]);
|
|
87777
87777
|
await db.initializeModels();
|
|
87778
87778
|
Logger.info("Create API Routes...\n");
|
|
87779
|
-
new RouterFactory(app,
|
|
87779
|
+
new RouterFactory(app, process.cwd(), "routes");
|
|
87780
87780
|
Logger.info("Starting Server...\n");
|
|
87781
87781
|
app.listen(port, () => {
|
|
87782
87782
|
Logger.info(`\nAPI Sever ready at: http://127.0.0.1:${port}\n`);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application Sever class
|
|
3
|
+
*/
|
|
1
4
|
export default class ApplicationServer {
|
|
2
5
|
/**
|
|
3
6
|
* Initializes the application server
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
7
|
+
* @param {number} port port for the micro service
|
|
8
|
+
* @param {object=} options additional server configuration
|
|
6
9
|
*/
|
|
7
|
-
static bootstrap(
|
|
10
|
+
static bootstrap(port: number, options: any): Promise<void>;
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=ApplicationServer.d.ts.map
|
|
@@ -5,13 +5,13 @@ export default class DatabaseConnector {
|
|
|
5
5
|
private static rootDir;
|
|
6
6
|
constructor(path: string);
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Initializes the database connection
|
|
9
9
|
* @param path
|
|
10
10
|
*/
|
|
11
11
|
static init(): Promise<Array<Sequelize>>;
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
|
-
* @param path root dir
|
|
14
|
+
* @param path root dir (__dirname)
|
|
15
15
|
*/
|
|
16
16
|
initializeModels(): Promise<void>;
|
|
17
17
|
getConnections(): Array<Sequelize>;
|