@men-mvc/foundation
Advanced tools
Comparing version 0.98.0 to 0.99.0
@@ -1,2 +0,2 @@ | ||
import { Express } from 'express'; | ||
import { Express, Request } from 'express'; | ||
import EventEmitter from 'events'; | ||
@@ -8,3 +8,6 @@ export declare abstract class BaseApplication { | ||
private static instance; | ||
private currentRequest; | ||
static init: <T extends BaseApplication>(application: T) => T; | ||
setCurrentRequest: (currentRequest: Request) => void; | ||
getCurrentRequest: () => Request; | ||
static getInstance: () => BaseApplication; | ||
@@ -11,0 +14,0 @@ setUp: () => Promise<void>; |
@@ -13,2 +13,12 @@ "use strict"; | ||
this.app = app; | ||
this.currentRequest = null; | ||
this.setCurrentRequest = (currentRequest) => { | ||
this.currentRequest = currentRequest; | ||
}; | ||
this.getCurrentRequest = () => { | ||
if (!this.currentRequest) { | ||
throw new Error(`Request has not been initialised.`); | ||
} | ||
return this.currentRequest; | ||
}; | ||
this.setUp = async () => { | ||
@@ -15,0 +25,0 @@ this.initialiseEventEmitter(); |
@@ -72,5 +72,5 @@ "use strict"; | ||
} | ||
const req = types_1.BaseApplication.getInstance().app.request; | ||
const req = types_1.BaseApplication.getInstance().getCurrentRequest(); | ||
return req.protocol + '://' + req.get('host'); | ||
}; | ||
exports.getAppBaseUrl = getAppBaseUrl; |
{ | ||
"name": "@men-mvc/foundation", | ||
"version": "0.98.0", | ||
"version": "0.99.0", | ||
"description": "Package that includes shared variables, types and utility functions for MEN MVC framework.", | ||
@@ -30,3 +30,3 @@ "private": false, | ||
"dependencies": { | ||
"@men-mvc/config": "^0.98.0", | ||
"@men-mvc/config": "^0.99.0", | ||
"express": "^4.18.2", | ||
@@ -53,3 +53,3 @@ "joi": "^17.9.1", | ||
"license": "MIT", | ||
"gitHead": "87993572bbfaceddaf50cd3f1b8e9adc68b51da5" | ||
"gitHead": "a452a43cfc2d3dd67ea8d05171f972eddd1403af" | ||
} |
75046
1544
+ Added@men-mvc/config@0.99.0(transitive)
- Removed@men-mvc/config@0.98.0(transitive)
Updated@men-mvc/config@^0.99.0