@loomcore/api 0.1.4 → 0.1.6
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/databases/index.d.ts +3 -0
- package/dist/databases/index.js +3 -0
- package/dist/databases/operations/index.d.ts +2 -0
- package/dist/databases/operations/index.js +2 -0
- package/dist/databases/postgres/index.d.ts +2 -0
- package/dist/databases/postgres/index.js +2 -0
- package/dist/utils/express.utils.d.ts +4 -3
- package/dist/utils/express.utils.js +2 -2
- package/package.json +1 -1
- package/dist/databases/utils/index.d.ts +0 -1
- package/dist/databases/utils/index.js +0 -1
package/dist/databases/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Application } from 'express';
|
|
2
|
-
import {
|
|
2
|
+
import { MongoClient } from "mongodb";
|
|
3
3
|
import { Server } from "http";
|
|
4
4
|
import { IBaseApiConfig } from "../models/index.js";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { IDatabase } from '../databases/models/index.js';
|
|
6
|
+
type RouteSetupFunction = (app: Application, database: IDatabase, config: IBaseApiConfig) => void;
|
|
7
|
+
declare function setupExpressApp(database: IDatabase, config: IBaseApiConfig, setupRoutes: RouteSetupFunction): Application;
|
|
7
8
|
declare function performGracefulShutdown(event: any, mongoClient: MongoClient | null, externalServer: Server | null, internalServer: Server | null): void;
|
|
8
9
|
export declare const expressUtils: {
|
|
9
10
|
setupExpressApp: typeof setupExpressApp;
|
|
@@ -6,7 +6,7 @@ import qs from 'qs';
|
|
|
6
6
|
import { NotFoundError } from "../errors/not-found.error.js";
|
|
7
7
|
import { errorHandler } from "../middleware/error-handler.js";
|
|
8
8
|
import { ensureUserContext } from '../middleware/ensure-user-context.js';
|
|
9
|
-
function setupExpressApp(
|
|
9
|
+
function setupExpressApp(database, config, setupRoutes) {
|
|
10
10
|
const app = express();
|
|
11
11
|
app.set('query parser', (str) => {
|
|
12
12
|
return qs.parse(str, {});
|
|
@@ -24,7 +24,7 @@ function setupExpressApp(db, config, setupRoutes) {
|
|
|
24
24
|
credentials: true
|
|
25
25
|
}));
|
|
26
26
|
app.use(ensureUserContext);
|
|
27
|
-
setupRoutes(app,
|
|
27
|
+
setupRoutes(app, database, config);
|
|
28
28
|
app.use(async (req, res) => {
|
|
29
29
|
throw new NotFoundError(`Requested path, ${req.path}, Not Found`);
|
|
30
30
|
});
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|